Détail du package

@kvs/common-test-case

azu7MIT2.1.4

Common Test Case for KVS

readme

@kvs/common-test-case

Common Test Case for KVS

Install

Install with npm:

npm install @kvs/common-test-case

Usage

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.

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.

  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

License

MIT © azu

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

2.1.3 (2022-09-25)

Bug Fixes

2.1.2 (2022-08-21)

Bug Fixes

  • kvs/env: module entry point to browser (b8529ad)

2.1.1 (2022-03-03)

Note: Version bump only for package root

2.1.0 (2022-03-02)

Bug Fixes

  • indexeddb: remove "debug" option (#25) (606b9a2)

Performance Improvements

2.0.0 (2022-02-19)

Bug Fixes

BREAKING CHANGES

  • storage: storage package sperate storags by name option

Affected Packages

  • @kvs/env in Node.js
    • 📝 Browser is not affected because it uses IndexedDB
  • @kvs/storage
  • @kvs/localstorage
  • @kvs/memorystorage
  • @kvs/node-localstorage
  • @kvs/storage-sync

1.2.0 (2021-04-17)

Features

  • types: Use Key Remapping in Mapped Types. (#17) (7c099be)

BREAKING CHANGES

  • types: require TypeScript 4.1+

It aims to support to following schema:

const storage = kvs<{
    [index: string]: string;
}>;

1.1.0 (2020-10-29)

Features

1.0.0 (2020-08-22)

Note: Version bump only for package kvs

0.3.1 (2020-08-22)

Note: Version bump only for package kvs

0.3.0 (2020-08-22)

Features

  • storage-sync: add storage-sync package (#11) (5748776)

0.2.1 (2020-08-22)

Note: Version bump only for package kvs

0.2.0 (2020-08-08)

Features

  • @kvs/env: migrate Schema Type (0951d08)
  • @kvs/indexeddb: migrate Schema Type (ec143e2)
  • @kvs/localstorage: migrate to Schema type (0c84640)
  • @kvs/memorystorage: migrate to Schema type (84d75f4)
  • storage: use Schema interface (2560aae)

0.1.0 (2020-08-08)

Bug Fixes

Features

  • @kvs/localstorage: add localstorage implementation (54fc38b)
  • @kvs/memorystorage: add in memory implementation (553247b)
  • @kvs/node-localstorage: add node implementation (5160012)
  • @lvs/env: add universal env (36eef88)
  • add close() to interface (a269d1d)
  • add debug options (75a083e)
  • kvs/indexeddb: add [Symbol.asyncIterator] (68392d4)
  • kvs/indexeddb: add dropInstance (0a38a0c)
  • kvs/indexeddb: implement basic usage (cc14444)