Skip to content

Commit 291bd84

Browse files
Change mock
Signed-off-by: Thomas Poignant <[email protected]>
1 parent ae986e7 commit 291bd84

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

libs/providers/go-feature-flag/src/lib/go-feature-flag-provider.test.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,10 +1008,14 @@ describe('GoFeatureFlagProvider', () => {
10081008
});
10091009

10101010
it('Should error if flag configuration endpoint return a 404', async () => {
1011-
jest.useRealTimers();
1012-
fetchMock.mockResponseOnce(getConfigurationEndpointResult(), {
1013-
status: 404,
1014-
headers: { 'Content-Type': 'application/json' },
1011+
fetchMock.mockIf(/^http:\/\/localhost:1031\/v1\/flag\/configuration/, async () => {
1012+
return {
1013+
body: '{}',
1014+
status: 404,
1015+
headers: {
1016+
'Content-Type': 'application/json',
1017+
},
1018+
};
10151019
});
10161020

10171021
const provider = new GoFeatureFlagProvider({
@@ -1027,10 +1031,14 @@ describe('GoFeatureFlagProvider', () => {
10271031
});
10281032

10291033
it('Should error if flag configuration endpoint return a 403', async () => {
1030-
jest.useRealTimers();
1031-
fetchMock.mockResponseOnce(getConfigurationEndpointResult(), {
1032-
status: 403,
1033-
headers: { 'Content-Type': 'application/json' },
1034+
fetchMock.mockIf(/^http:\/\/localhost:1031\/v1\/flag\/configuration/, async () => {
1035+
return {
1036+
body: '{}',
1037+
status: 403,
1038+
headers: {
1039+
'Content-Type': 'application/json',
1040+
},
1041+
};
10341042
});
10351043

10361044
const provider = new GoFeatureFlagProvider({

0 commit comments

Comments
 (0)