# @kvs/common-test-case

> Common Test Case for KVS

Latest version **2.2.2** (published 2026-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kvs/common-test-case
pnpm add @kvs/common-test-case
yarn add @kvs/common-test-case
bun add @kvs/common-test-case
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.2.2 |
| Published | 2026-01-18 |
| First published | 2020-08-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 44.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 190 |
| Author | azu |
| Maintainers | azu |

## Links

- npm: https://www.npmjs.com/package/@kvs/common-test-case
- Repository: https://github.com/azu/kvs
- Homepage: https://github.com/azu/kvs/tree/master/packages/common-test-case/
- Issues: https://github.com/azu/kvs/issues
- npm.io page: https://npm.io/package/@kvs/common-test-case

## Dependencies (1)

- [@kvs/types](https://npm.io/package/@kvs/types.md) ^2.2.2

## Recent versions

- 2.2.2 (latest) — 2026-01-18
- 2.2.1 — 2026-01-18
- 2.1.4 — 2023-07-21
- 2.1.3 — 2022-09-25
- 2.1.1 — 2022-03-03
- 2.1.0 — 2022-03-02
- 2.0.0 — 2022-02-19
- 1.2.0 — 2021-04-17
- 1.1.0 — 2020-10-29
- 1.0.0 — 2020-08-22
- 0.3.0 — 2020-08-22
- 0.2.1 — 2020-08-22
- 0.2.0 — 2020-08-08
- 0.1.0 — 2020-08-08

## README

# @kvs/common-test-case

Common Test Case for KVS

## Install

Install with [npm](https://www.npmjs.com/):

    npm install @kvs/common-test-case

## Usage

```ts
import { kvsLocalStorage } from "../src";
import { createKVSTestCase } from "@kvs/common-test-case";

const databaseName = "kvs-test";
const kvsTestCase = createKVSTestCase(
    (options) =>
        kvsLocalStorage({
            name: databaseName,
            ...options,
            debug: true
        }),
    {
        setTestDataList: [
            {
                name: "string",
                value: "str"
            },
            {
                name: "number",
                value: 42
            },
            {
                name: "boolean",
                value: false
            },
            {
                name: "object",
                value: {
                    prop: "propValue"
                },
                type: "object"
            }
            // Edge, old-Safari does not support Blob
            // https://github.com/jakearchibald/idb/issues/58
            // {
            //     name: "blob",
            //     value: new Blob(["Hello, world!"], { type: "text/plain" }),
            //     type: "object"
            // }
        ]
    }
);
const deleteAllDB = async () => {
    if (!kvsTestCase.ref.current) {
        return;
    }
    try {
        await kvsTestCase.ref.current.clear();
        await kvsTestCase.ref.current.dropInstance();
    } catch (error) {
        console.error("deleteAllDB", error);
    }
};
describe("@kvs/node-localstorage", () => {
    beforeEach(deleteAllDB);
    kvsTestCase.run();
});

```

## Changelog

See [Releases page](https://github.com/azu/kvs/releases).

## Running tests

Install devDependencies and Run `npm test`:

    npm test

## Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, [please create an issue](https://github.com/azu/kvs/issues).

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

## Author

- [github/azu](https://github.com/azu)
- [twitter/azu_re](https://twitter.com/azu_re)

## License

MIT © azu

---
_Source: https://npm.io/package/@kvs/common-test-case · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
