Skip to content

Commit 4b1119a

Browse files
committed
Add adapter-test for filtering on pathname
1 parent e5abec4 commit 4b1119a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

adapter-tests/unit-tests.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ module.exports = function testAdapter(options) {
6565
});
6666
});
6767

68+
it('should return filtered saves on getAll', async () => {
69+
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
70+
await adapter.put('/another-key', { views: [{ time: 1490623474639 }] });
71+
await adapter.put('/b-key', { views: [{ time: 1490623474639 }] });
72+
73+
expect(await adapter.getAll({ pathname: '/a' })).toEqual({
74+
'/a-key': { views: [{ time: 1490623474639 }] },
75+
'/another-key': { views: [{ time: 1490623474639 }] },
76+
});
77+
});
78+
6879
it('should have check whether a key is stored with has', async () => {
6980
await adapter.put('/a-key', { views: [{ time: 1490623474639 }] });
7081

@@ -73,7 +84,6 @@ module.exports = function testAdapter(options) {
7384
});
7485

7586
if (typeof adapter.subscribe === "function") {
76-
7787
it('should allow subscription with observables', async () => {
7888
const listener = jest.fn();
7989
const unsubscribe = adapter.subscribe(listener);

0 commit comments

Comments
 (0)