Skip to content

Commit 5bd7edb

Browse files
committed
Mocker ut samtlige metoder i formsApiUtils
1 parent 54ed2ef commit 5bd7edb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/bygger-backend/src/services/forms/FormsService.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@ vi.mock('../../fetchUtils', () => ({
88
fetchWithErrorHandling: vi.fn(),
99
}));
1010

11-
vi.mock('../utils/formsApiUtils', () => ({
12-
createHeaders: vi.fn(),
13-
}));
11+
vi.mock(import('../utils/formsApiUtils'), async (importOriginal) => {
12+
const actual = await importOriginal();
13+
return {
14+
...actual,
15+
createHeaders: vi.fn(),
16+
};
17+
});
1418

1519
describe('FormsService', () => {
1620
const formsApiUrl = 'http://example.com';
1721
let formsService;
1822
const accessToken = 'test-token';
1923
const form: Form = {
20-
properties: {} as FormPropertiesType,
24+
properties: { submissionTypes: [] } as unknown as FormPropertiesType,
2125
id: 1,
2226
path: 'test-form',
2327
title: 'Test Form',

0 commit comments

Comments
 (0)