Skip to content

Commit f048788

Browse files
committed
fix test
1 parent 880a5ba commit f048788

3 files changed

Lines changed: 28 additions & 19 deletions

File tree

apps/sim/app/api/workspaces/invitations/[invitationId]/route.test.ts

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,21 @@ describe('Workspace Invitation [invitationId] API Route', () => {
6161
hasWorkspaceAdminAccess: mockHasWorkspaceAdminAccess,
6262
}))
6363

64-
vi.doMock('@/lib/env', () => ({
65-
env: {
64+
vi.doMock('@/lib/env', () => {
65+
const mockEnv = {
6666
NEXT_PUBLIC_APP_URL: 'https://test.sim.ai',
6767
BILLING_ENABLED: false,
68-
},
69-
isTruthy: (value: string | boolean | number | undefined) =>
70-
typeof value === 'string'
71-
? value.toLowerCase() === 'true' || value === '1'
72-
: Boolean(value),
73-
getEnv: (variable: string) => process.env[variable],
74-
}))
68+
}
69+
return {
70+
env: mockEnv,
71+
isTruthy: (value: string | boolean | number | undefined) =>
72+
typeof value === 'string'
73+
? value.toLowerCase() === 'true' || value === '1'
74+
: Boolean(value),
75+
getEnv: (variable: string) =>
76+
mockEnv[variable as keyof typeof mockEnv] ?? process.env[variable],
77+
}
78+
})
7579

7680
mockTransaction = vi.fn()
7781
const mockDbChain = {
@@ -384,17 +388,21 @@ describe('Workspace Invitation [invitationId] API Route', () => {
384388
vi.doMock('@/lib/permissions/utils', () => ({
385389
hasWorkspaceAdminAccess: vi.fn(),
386390
}))
387-
vi.doMock('@/lib/env', () => ({
388-
env: {
391+
vi.doMock('@/lib/env', () => {
392+
const mockEnv = {
389393
NEXT_PUBLIC_APP_URL: 'https://test.sim.ai',
390394
BILLING_ENABLED: false,
391-
},
392-
isTruthy: (value: string | boolean | number | undefined) =>
393-
typeof value === 'string'
394-
? value.toLowerCase() === 'true' || value === '1'
395-
: Boolean(value),
396-
getEnv: (variable: string) => process.env[variable],
397-
}))
395+
}
396+
return {
397+
env: mockEnv,
398+
isTruthy: (value: string | boolean | number | undefined) =>
399+
typeof value === 'string'
400+
? value.toLowerCase() === 'true' || value === '1'
401+
: Boolean(value),
402+
getEnv: (variable: string) =>
403+
mockEnv[variable as keyof typeof mockEnv] ?? process.env[variable],
404+
}
405+
})
398406
vi.doMock('@sim/db/schema', () => ({
399407
workspaceInvitation: { id: 'id' },
400408
}))

apps/sim/lib/email/mailer.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ vi.mock('@/lib/env', () => ({
4343

4444
vi.mock('@/lib/urls/utils', () => ({
4545
getEmailDomain: vi.fn().mockReturnValue('sim.ai'),
46+
getBaseUrl: vi.fn().mockReturnValue('https://test.sim.ai'),
4647
}))
4748

4849
import { type EmailType, sendBatchEmails, sendEmail } from '@/lib/email/mailer'

apps/sim/tools/http/request.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('HTTP Request Tool', () => {
1818

1919
beforeEach(() => {
2020
tester = new ToolTester(requestTool)
21-
process.env.NEXT_PUBLIC_APP_URL = 'http://localhost:3000'
21+
process.env.NEXT_PUBLIC_APP_URL = 'https://app.simstudio.dev'
2222
})
2323

2424
afterEach(() => {

0 commit comments

Comments
 (0)