@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.
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
License
MIT © azu