Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg committed Sep 10, 2024
1 parent db37d65 commit 54d3889
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions test/analytics.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Sample test
import { defaultState, getFlagsmith, getMockFetchWithValue, mockFetch, testIdentity } from './test-constants';
import { getFlagsmith, getMockFetchWithValue, testIdentity } from './test-constants';

describe.only('Analytics', () => {

beforeEach(() => {
jest.useFakeTimers(); // Mock the timers
jest.useFakeTimers(); // Mocked to allow time to pass for analytics flush
});
afterEach(() => {
jest.useRealTimers(); // Restore real timers after each test
jest.useRealTimers();
});
test('should not attempt to track events when split testing is disabled', async () => {
const { flagsmith } = getFlagsmith({
Expand Down Expand Up @@ -113,5 +113,4 @@ describe.only('Analytics', () => {
},
);
});

});
2 changes: 1 addition & 1 deletion test/test-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function getStateToCheck(_state: IState) {
return state;
}

export function getFlagsmith(config: Partial<IInitConfig> = {}, mockFetch?:ModuleMocker['fn']) {
export function getFlagsmith(config: Partial<IInitConfig> = {}, mockFetch?:any) {
const flagsmith = createFlagsmithInstance();
const AsyncStorage = new MockAsyncStorage();
const _mockFetch = mockFetch || jest.fn(async (url:string, options) => {
Expand Down

0 comments on commit 54d3889

Please sign in to comment.