Skip to content

Commit 8725b7c

Browse files
check only the collector endpoint
Signed-off-by: Thomas Poignant <[email protected]>
1 parent 62af020 commit 8725b7c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,11 +1237,15 @@ describe('GoFeatureFlagProvider', () => {
12371237
],
12381238
};
12391239

1240-
const lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1];
1241-
expect(lastCall).toBeDefined();
1242-
expect(lastCall[0]).toBe('http://localhost:1031/v1/data/collector');
1243-
expect(lastCall[1]?.body).toBeDefined();
1244-
expect(JSON.parse(lastCall[1]?.body as string)).toEqual(want);
1240+
// Find the last call to /v1/data/collector
1241+
const dataCollectorCalls = fetchMock.mock.calls.filter(
1242+
(call) => call[0] === 'http://localhost:1031/v1/data/collector',
1243+
);
1244+
const lastDataCollectorCall = dataCollectorCalls[dataCollectorCalls.length - 1];
1245+
expect(lastDataCollectorCall).toBeDefined();
1246+
expect(lastDataCollectorCall[0]).toBe('http://localhost:1031/v1/data/collector');
1247+
expect(lastDataCollectorCall[1]?.body).toBeDefined();
1248+
expect(JSON.parse(lastDataCollectorCall[1]?.body as string)).toEqual(want);
12451249
});
12461250

12471251
it('should track events without tracking details', async () => {

0 commit comments

Comments
 (0)