mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
fix(ci): mock secureFetchWithPinnedIP in tools tests to prevent timeouts
This commit is contained in:
@@ -26,6 +26,8 @@ const {
|
||||
mockListCustomTools,
|
||||
mockGetCustomToolByIdOrTitle,
|
||||
mockGenerateInternalToken,
|
||||
mockSecureFetchWithPinnedIP,
|
||||
mockValidateUrlWithDNS,
|
||||
} = vi.hoisted(() => ({
|
||||
mockIsHosted: { value: false },
|
||||
mockEnv: { NEXT_PUBLIC_APP_URL: 'http://localhost:3000' } as Record<string, string | undefined>,
|
||||
@@ -40,6 +42,8 @@ const {
|
||||
mockListCustomTools: vi.fn(),
|
||||
mockGetCustomToolByIdOrTitle: vi.fn(),
|
||||
mockGenerateInternalToken: vi.fn(),
|
||||
mockSecureFetchWithPinnedIP: vi.fn(),
|
||||
mockValidateUrlWithDNS: vi.fn(),
|
||||
}))
|
||||
|
||||
// Mock feature flags
|
||||
@@ -73,6 +77,11 @@ vi.mock('@/lib/auth/internal', () => ({
|
||||
|
||||
vi.mock('@/lib/billing/core/usage-log', () => ({}))
|
||||
|
||||
vi.mock('@/lib/core/security/input-validation.server', () => ({
|
||||
secureFetchWithPinnedIP: (...args: unknown[]) => mockSecureFetchWithPinnedIP(...args),
|
||||
validateUrlWithDNS: (...args: unknown[]) => mockValidateUrlWithDNS(...args),
|
||||
}))
|
||||
|
||||
vi.mock('@/lib/core/rate-limiter/hosted-key', () => ({
|
||||
getHostedKeyRateLimiter: () => mockRateLimiterFns,
|
||||
}))
|
||||
@@ -476,6 +485,11 @@ describe('Automatic Internal Route Detection', () => {
|
||||
beforeEach(() => {
|
||||
process.env.NEXT_PUBLIC_APP_URL = 'http://localhost:3000'
|
||||
cleanupEnvVars = setupEnvVars({ NEXT_PUBLIC_APP_URL: 'http://localhost:3000' })
|
||||
|
||||
mockValidateUrlWithDNS.mockResolvedValue({ isValid: true, resolvedIP: '93.184.216.34' })
|
||||
mockSecureFetchWithPinnedIP.mockResolvedValue(
|
||||
new Response(JSON.stringify({}), { status: 200, headers: { 'content-type': 'application/json' } })
|
||||
)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
Reference in New Issue
Block a user