Test suite for Keyv API compliancy

Downloads in past


1,96231.8.724 days ago5 years agoMinified + gzip package size for @keyv/test-suite in KB


@keyv/test-suite keyv
Test suite for Keyv API compliance

build codecov npm npm
Complete AVA test suite to test a Keyv storage adapter for API compliance.



Install AVA, Keyv and @keyv/test-suite as development dependencies.
npm install --save-dev ava keyv @keyv/test-suite

Then update keyv and @keyv/test-suite versions to * in package.json to ensure you're always testing against the latest version.

Create Test File

import test from 'ava';
import keyvTestSuite from '@keyv/test-suite';
import Keyv from 'keyv';
import KeyvStore from './';

const store = () => new KeyvStore();
keyvTestSuite(test, Keyv, store);

Where KeyvStore is your storage adapter.
Set your test script in package.json to ava.
"scripts": {
  "test": "ava"

Example for Storage Adapters

Take a look at keyv-redis for an example of an existing storage adapter using @keyv/test-suite.

Testing Compression Adapters

If you're testing a compression adapter, you can use the keyvCompresstionTests method instead of keyvTestSuite.
const {keyvCompresstionTests} = require('@keyv/test-suite');
const KeyvGzip = require('@keyv/compress-gzip');

keyvCompresstionTests(test, new KeyvGzip());


MIT © Jared Wray