Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolie Rabideau authored and Jolie Rabideau committed Mar 27, 2024
1 parent 9ba9f35 commit fdfa706
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/main/services/project-settings.service-host.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { testingProjectSettingsService } from '@main/services/project-settings.service-host';
import { ProjectSettingValidator } from '@shared/services/project-settings.service-model';

jest.mock('@shared/services/network.service', () => ({
...jest.requireActual('@shared/services/network.service'),
registerRequestHandler: () => {
return {};
},
}));
jest.mock('@main/data/core-project-settings-info.data', () => ({
...jest.requireActual('@main/data/core-project-settings-info.data'),
__esModule: true,
coreProjectSettingsInfo: {
default: {
'platform.fullName': { default: '%test_project_full_name_missing%' },
'platform.language': { default: '%test_project_language_missing%' },
'platformScripture.booksPresent': {
Expand Down Expand Up @@ -47,4 +55,21 @@ describe('getDefault', () => {
testingProjectSettingsService.getDefault(projectSettingKey, 'ParatextStandard'),
).rejects.toThrow(new RegExp(`default value for project setting ${projectSettingKey}`));
});

describe('registerValidator', () => {
it('should resolve', async () => {
const projectSettingKey = 'platform.fullName';
const fullNameSettingsValidator: ProjectSettingValidator<
'platform.fullName'
> = async (): Promise<boolean> => {
return true;
};
await expect(
testingProjectSettingsService.registerValidator(
projectSettingKey,
fullNameSettingsValidator,
),
).resolves.toStrictEqual({});
});
});
});

0 comments on commit fdfa706

Please sign in to comment.