Skip to content

Commit cb6a565

Browse files
committed
fix: tests
1 parent 899f1a3 commit cb6a565

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

packages/backend/src/apps/formsg/__tests__/app.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ import type { IGlobalVariable } from '@plumber/types'
33
import type { AxiosPromise } from 'axios'
44
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
55

6+
import apps from '@/apps'
67
import globalVariable from '@/helpers/global-variable'
78
import type Connection from '@/models/connection'
89

9-
import formSgApp from '../'
10-
1110
const mocks = vi.hoisted(() => ({
1211
axiosRequestAdapter: vi.fn(
1312
async (requestConfig): AxiosPromise => ({
@@ -53,7 +52,7 @@ describe('FormSG app', () => {
5352
connection: {
5453
formattedData: {},
5554
} as unknown as Connection,
56-
app: formSgApp,
55+
app: apps.formsg,
5756
})
5857
})
5958

packages/backend/src/apps/formsg/__tests__/auth/decrypt-form-response.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { IGlobalVariable, IRequest } from '@plumber/types'
33
import { Settings as LuxonSettings } from 'luxon'
44
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
55

6+
import apps from '@/apps'
67
import { FOR_EACH_INPUT_SOURCE } from '@/apps/toolbox/common/constants'
78

8-
import app from '../..'
99
import { decryptFormResponse } from '../../auth/decrypt-form-response'
1010
import { NricFilter } from '../../triggers/new-submission'
1111

@@ -92,7 +92,7 @@ describe('decrypt form response', () => {
9292
},
9393
step: {
9494
id: '123',
95-
appKey: app.key,
95+
appKey: apps.formsg.key,
9696
position: 0,
9797
parameters: {
9898
nricFilter: undefined,
@@ -110,7 +110,7 @@ describe('decrypt form response', () => {
110110
createdAt: `${new Date().getTime()}`,
111111
updatedAt: `${new Date().getTime()}`,
112112
},
113-
app,
113+
app: apps.formsg,
114114
}
115115
})
116116

packages/backend/src/apps/formsg/__tests__/auth/verify-credentials.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { IGlobalVariable, IHttpClient } from '@plumber/types'
22

33
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
44

5-
import app from '../..'
5+
import apps from '@/apps'
6+
67
import {
78
parseFormIdFormat,
89
parseSecretKeyFormat,
@@ -49,7 +50,7 @@ describe('verify credentials', () => {
4950
},
5051
}),
5152
} as unknown as IHttpClient, // deliberately cast
52-
app,
53+
app: apps.formsg,
5354
}
5455
})
5556

packages/backend/src/apps/formsg/__tests__/common/webhook-settings.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { IGlobalVariable, IHttpClient } from '@plumber/types'
33
import { AxiosError } from 'axios'
44
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
55

6+
import apps from '@/apps'
67
import HttpError from '@/errors/http'
78

8-
import app from '../..'
99
import {
1010
FORMSG_WEBHOOK_REGISTRATION_MESSAGE,
1111
FORMSG_WEBHOOK_VERIFICATION_MESSAGE,
@@ -37,7 +37,7 @@ describe('formsg webhook registration', () => {
3737
createdAt: `${new Date().getTime()}`,
3838
updatedAt: `${new Date().getTime()}`,
3939
},
40-
app,
40+
app: apps.formsg,
4141
}
4242
})
4343

0 commit comments

Comments
 (0)