Skip to content

Commit

Permalink
UIE-204 Narrow Ajax Usage pt12
Browse files Browse the repository at this point in the history
- improved type safety in mocks for test in TermsOfServicePage.test.ts
  • Loading branch information
msilva-broad committed Nov 18, 2024
1 parent 5d7a8b8 commit db356c9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/registration/terms-of-service/TermsOfServicePage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import { Groups, GroupsContract } from 'src/libs/ajax/Groups';
import { Metrics, MetricsContract } from 'src/libs/ajax/Metrics';
import { SamUserTermsOfServiceDetails, TermsOfService, TermsOfServiceContract } from 'src/libs/ajax/TermsOfService';
import {
OrchestrationUserPreferLegacyFireCloudResponse,
SamUserAllowances,
SamUserCombinedStateResponse,
SamUserResponse,
User,
UserContract,
} from 'src/libs/ajax/User';
import { AuthState, authStore } from 'src/libs/state';
import { AuthState, authStore, TerraUserProfile } from 'src/libs/state';
import { TermsOfServicePage } from 'src/registration/terms-of-service/TermsOfServicePage';
import { asMockedFn, MockedFn, partial, renderWithAppContexts as render } from 'src/testing/test-utils';

Expand Down Expand Up @@ -104,10 +105,10 @@ const setupMockAjax = async (
partial<UserContract>({
getSamUserCombinedState: jest.fn().mockResolvedValue(mockSamUserCombinedState),
profile: {
get: jest.fn().mockResolvedValue({ keyValuePairs: [] }),
update: jest.fn().mockResolvedValue({ keyValuePairs: [] }),
setPreferences: jest.fn().mockResolvedValue({}),
preferLegacyFirecloud: jest.fn().mockResolvedValue({}),
get: jest.fn(async () => partial<TerraUserProfile>({})),
update: jest.fn(async () => undefined),
setPreferences: jest.fn(async () => undefined),
preferLegacyFirecloud: jest.fn(async () => partial<OrchestrationUserPreferLegacyFireCloudResponse>({})),
},
getNihStatus,
})
Expand Down

0 comments on commit db356c9

Please sign in to comment.