Skip to content

Commit 604f610

Browse files
committed
Don't check for implemented methods, just fail when they're called
1 parent 2cc95c7 commit 604f610

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

sdk/index.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,6 @@ export class Flagsmith {
128128
}
129129

130130
if (!!data.cache) {
131-
const missingMethods: string[] = ['has', 'get', 'set'].filter(
132-
method => data.cache && !data.cache[method]
133-
);
134-
135-
if (missingMethods.length > 0) {
136-
throw new Error(
137-
`Please implement the following methods in your cache: ${missingMethods.join(
138-
', '
139-
)}`
140-
);
141-
}
142131
this.cache = data.cache;
143132
}
144133

tests/sdk/flagsmith-cache.test.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,6 @@ beforeEach(() => {
44
vi.clearAllMocks();
55
});
66

7-
test('test_wrong_cache_interface_throws_an_error', async () => {
8-
const cache = {
9-
set: () => { },
10-
get: () => { },
11-
};
12-
13-
expect(() => { const flg = flagsmith({ cache }); }).toThrow();
14-
});
15-
167
test('test_empty_cache_not_read_but_populated', async () => {
178
fetch.mockResolvedValue(new Response(flagsJSON));
189

0 commit comments

Comments
 (0)