Skip to content

Commit 5f56486

Browse files
committed
Update test to use cache
1 parent 7443c2d commit 5f56486

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/init.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,25 @@ describe('Flagsmith.init', () => {
8686
expect(flagsmith.getTrait("a")).toEqual(undefined)
8787
});
8888
test('identifying with new identity after logout should not carry over previous traits for different identity', async () => {
89+
// Given
8990
const onChange = jest.fn()
9091
const now = Date.now();
9192
const identityA = `test_identity_a_${now}`
9293
const identityB = `test_identity_b_${now}`
93-
const {flagsmith,initConfig} = getFlagsmith({onChange, identity:identityA, traits: {a:`example`}})
94+
const { flagsmith, initConfig } = getFlagsmith({
95+
onChange,
96+
identity: identityA,
97+
traits: { a: `example` },
98+
cacheOptions: { skipAPI: true },
99+
});
94100
await flagsmith.init(initConfig);
95101
expect(flagsmith.getTrait("a")).toEqual(`example`)
96102

103+
// When
97104
await flagsmith.logout()
98105
await flagsmith.identify(identityB)
106+
107+
// Then
99108
expect(flagsmith.getTrait("a")).toEqual(undefined)
100109
});
101110
});

0 commit comments

Comments
 (0)