Skip to content

Commit dc186c4

Browse files
committed
test(coverage): uped the coverage of branches
1 parent e7446f2 commit dc186c4

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

test/cache.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ test('set/get expired val', async t => {
1919
t.is(cachedVal, null);
2020
});
2121

22+
test('set/get expired val without validation', async t => {
23+
await t.context.cache.set('store', 'key', 'val');
24+
const cachedVal = await t.context.cache.get('store', 'key', false);
25+
t.is(cachedVal, 'val');
26+
});
27+
2228
test('get non-existent val', async t => {
2329
const cachedVal = await t.context.cache.get('store', 'key');
2430
t.is(cachedVal, null);
@@ -51,3 +57,8 @@ test('remove val on non-existent store', async t => {
5157
test('illegal store name', async t => {
5258
t.throws(() => factory(localforageStub)(['with spaces']), UnityCacheError);
5359
});
60+
61+
test('does not throw on cache params', async t => {
62+
const cache = factory(localforageStub)(['store'], 'test', 'test database', 'localStorage');
63+
t.pass();
64+
});

test/error.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ test('instance of UnityCacheError', t => {
1515

1616
test('to string', t => {
1717
t.is(t.context.error.toString(), 'UnityCacheError: Something something')
18+
});
19+
20+
test('empty message', t => {
21+
t.is((new UnityCacheError()).toString(), 'UnityCacheError')
1822
});

0 commit comments

Comments
 (0)