Skip to content

Commit 1091412

Browse files
Fix date
Signed-off-by: Thomas Poignant <[email protected]>
1 parent 291bd84 commit 1091412

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

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

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,9 +1077,19 @@ describe('GoFeatureFlagProvider', () => {
10771077
});
10781078

10791079
it('Should apply a scheduled rollout step', async () => {
1080-
fetchMock.mockResponseOnce(getConfigurationEndpointResult('scheduled-rollout'), {
1081-
status: 200,
1082-
headers: { 'Content-Type': 'application/json' },
1080+
jest.useRealTimers();
1081+
fetchMock.mockIf(/^http:\/\/localhost:1031\/v1\/flag\/configuration/, async () => {
1082+
const res = getConfigurationEndpointResult('scheduled-rollout');
1083+
// Keep the console.log for debugging as in the original code
1084+
console.log('res', res);
1085+
console.log('date', new Date());
1086+
return {
1087+
body: res,
1088+
status: 200,
1089+
headers: {
1090+
'Content-Type': 'application/json',
1091+
},
1092+
};
10831093
});
10841094

10851095
const provider = new GoFeatureFlagProvider({
@@ -1452,7 +1462,7 @@ describe('GoFeatureFlagProvider', () => {
14521462
});
14531463
});
14541464

1455-
function getConfigurationEndpointResult(mode = 'default') {
1465+
function getConfigurationEndpointResult(mode = 'default'): string {
14561466
const filePath = path.resolve(__dirname, 'testdata', 'flag-configuration', mode + '.json');
14571467
const fileContent = fs.readFileSync(filePath, 'utf-8');
14581468
return JSON.stringify(JSON.parse(fileContent));

0 commit comments

Comments
 (0)