2018-08-30 23:11:09 +00:00
|
|
|
import { expect, tap } from '@pushrocks/tapbundle';
|
2017-07-12 15:13:29 +00:00
|
|
|
|
2018-08-30 23:11:09 +00:00
|
|
|
import * as npmextra from '../ts/index';
|
2017-07-12 15:13:29 +00:00
|
|
|
|
2018-08-30 23:11:09 +00:00
|
|
|
let myKeyValueStore: npmextra.KeyValueStore;
|
2017-07-12 15:13:29 +00:00
|
|
|
|
|
|
|
tap.test('should create a keyValueStore', async () => {
|
2018-08-30 23:11:09 +00:00
|
|
|
myKeyValueStore = new npmextra.KeyValueStore('custom', 'test');
|
|
|
|
expect(myKeyValueStore).to.be.instanceof(npmextra.KeyValueStore);
|
|
|
|
});
|
2017-07-12 15:13:29 +00:00
|
|
|
|
|
|
|
tap.test('expect result to be empty', async () => {
|
2018-08-30 23:11:09 +00:00
|
|
|
let result = myKeyValueStore.readAll();
|
2017-07-12 15:13:29 +00:00
|
|
|
// tslint:disable-next-line:no-unused-expression
|
2018-08-30 23:11:09 +00:00
|
|
|
expect(result).to.be.empty;
|
|
|
|
});
|
2017-07-12 15:13:29 +00:00
|
|
|
|
|
|
|
tap.test('expect to add an object to the kv Store', async () => {
|
2017-08-16 16:25:45 +00:00
|
|
|
await myKeyValueStore.writeAll({
|
2021-01-27 21:00:49 +00:00
|
|
|
myKey: 'myValue',
|
2018-08-30 23:11:09 +00:00
|
|
|
});
|
|
|
|
await expect(myKeyValueStore.readKey('myKey')).to.eventually.equal('myValue');
|
|
|
|
});
|
2017-07-12 15:13:29 +00:00
|
|
|
|
2018-08-30 23:11:09 +00:00
|
|
|
tap.start();
|