2.0.2 • Published 9 months ago

@keyv/test-suite v2.0.2

Weekly downloads
49
License
MIT
Repository
github
Last release
9 months ago

@keyv/test-suite

Test suite for Keyv API compliance

build codecov npm npm

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

Usage

Install

Install vitest, keyv and @keyv/test-suite as development dependencies.

npm install --save-dev vitest 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

test.js

import test from 'vitest';
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 vitest.

"scripts": {
  "test": "vitest"
}

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.

import test from 'vitest';
import { keyvCompresstionTests, KeyvGzip } from '@keyv/test-suite';
import Keyv from 'keyv';

keyvCompresstionTests(test, new KeyvGzip());

License

MIT © Jared Wray

2.0.2

9 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.9.5

2 years ago

1.9.4

2 years ago

1.9.3

2 years ago

1.9.1

2 years ago

1.9.2

2 years ago

1.9.0

2 years ago

1.8.9

3 years ago

1.8.8

3 years ago

1.8.7

3 years ago

1.8.6

3 years ago

1.7.6

3 years ago

1.7.5

3 years ago

1.7.4

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.13

4 years ago

1.6.15

4 years ago

1.6.14

4 years ago

1.6.12

4 years ago

1.6.11

7 years ago

1.6.10

8 years ago

1.6.9

8 years ago

1.6.8

8 years ago

1.6.7

8 years ago

1.6.6

8 years ago

1.6.5

8 years ago

1.6.4

8 years ago

1.6.3

8 years ago

1.6.2

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.2

8 years ago

1.5.1

8 years ago