Skip to content

Commit cdde2b2

Browse files
check only the collector endpoint
Signed-off-by: Thomas Poignant <[email protected]>
1 parent 172cf4e commit cdde2b2

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
@@ -1304,11 +1304,15 @@ describe('GoFeatureFlagProvider', () => {
13041304
],
13051305
};
13061306

1307-
const lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1];
1308-
expect(lastCall).toBeDefined();
1309-
expect(lastCall[0]).toBe('http://localhost:1031/v1/data/collector');
1310-
expect(lastCall[1]?.body).toBeDefined();
1311-
expect(JSON.parse(lastCall[1]?.body as string)).toEqual(want);
1307+
// Find the last call to /v1/data/collector
1308+
const dataCollectorCalls = fetchMock.mock.calls.filter(
1309+
(call) => call[0] === 'http://localhost:1031/v1/data/collector',
1310+
);
1311+
const lastDataCollectorCall = dataCollectorCalls[dataCollectorCalls.length - 1];
1312+
expect(lastDataCollectorCall).toBeDefined();
1313+
expect(lastDataCollectorCall[0]).toBe('http://localhost:1031/v1/data/collector');
1314+
expect(lastDataCollectorCall[1]?.body).toBeDefined();
1315+
expect(JSON.parse(lastDataCollectorCall[1]?.body as string)).toEqual(want);
13121316
});
13131317

13141318
it('should track multiple events', async () => {

0 commit comments

Comments
 (0)