Skip to content

Commit

Permalink
Adjust unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leoromanovsky committed Aug 1, 2024
1 parent a88ac51 commit 3668271
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ describe('EppoJSClient E2E test', () => {
apiKey,
baseUrl,
assignmentLogger: mockLogger,
forceReinitialize: true,
});
});

Expand Down Expand Up @@ -335,6 +336,7 @@ describe('EppoJSClient E2E test', () => {
apiKey,
baseUrl,
assignmentLogger: mockLogger,
forceReinitialize: true,
});
});

Expand Down Expand Up @@ -778,6 +780,7 @@ describe('initialization options', () => {
apiKey,
baseUrl,
assignmentLogger: mockLogger,
forceReinitialize: true,
});

expect(fetchCallCount).toBe(1);
Expand All @@ -790,6 +793,7 @@ describe('initialization options', () => {
baseUrl: 'https://thisisabaddomainforthistest.com',
assignmentLogger: mockLogger,
useExpiredCache: true,
forceReinitialize: true,
});

// Should serve assignment from cache before fetch even fails
Expand All @@ -809,6 +813,7 @@ describe('initialization options', () => {
baseUrl: 'https://thisisabaddomainforthistest.com',
assignmentLogger: mockLogger,
useExpiredCache: true,
forceReinitialize: true,
}),
).rejects.toThrow();
});
Expand Down Expand Up @@ -909,6 +914,7 @@ describe('initialization options', () => {
baseUrl,
assignmentLogger: mockLogger,
updateOnFetch,
forceReinitialize: true,
});

expect(fetchCallCount).toBe(1);
Expand All @@ -926,6 +932,7 @@ describe('initialization options', () => {
assignmentLogger: mockLogger,
updateOnFetch,
useExpiredCache: true,
forceReinitialize: true,
});

// Should serve assignment from cache before fetch completes
Expand Down Expand Up @@ -955,6 +962,7 @@ describe('initialization options', () => {
assignmentLogger: mockLogger,
updateOnFetch,
maxCacheAgeSeconds: fetchResolveDelayMs * 10,
forceReinitialize: true,
});

// No fetch will have been kicked off because of valid cache; previously fetched values will be served
Expand Down Expand Up @@ -997,6 +1005,7 @@ describe('initialization options', () => {
apiKey,
baseUrl,
assignmentLogger: mockLogger,
forceReinitialize: true,
});
});

Expand All @@ -1010,6 +1019,7 @@ describe('initialization options', () => {
apiKey,
baseUrl,
assignmentLogger: mockLogger,
forceReinitialize: true,
});
expect(getInstance().getStringAssignment(flagKey, 'subject', {}, 'default-value')).toBe(
'default-value',
Expand Down

0 comments on commit 3668271

Please sign in to comment.