Skip to content

Commit 38ac654

Browse files
committed
test(ts-sdk): cover the default www host
1 parent 5411d74 commit 38ac654

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

‎packages/ts-sdk/src/index.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,19 @@ describe('client identity', () => {
245245
)
246246
expect(headers['X-API-Key']).toBe('test-api-key')
247247
})
248+
249+
it('sends requests to the canonical www host when no baseUrl is given', async () => {
250+
const client = new SimStudioClient({ apiKey: 'test-api-key' })
251+
vi.mocked(mockFetch).mockClear()
252+
vi.mocked(mockFetch).mockResolvedValue({
253+
ok: true,
254+
status: 200,
255+
headers: { get: () => null },
256+
json: async () => ({ data: { isDeployed: true } }),
257+
} as any)
258+
259+
await client.getWorkflowStatus('workflow-id')
260+
261+
expect(String(vi.mocked(mockFetch).mock.calls[0][0])).toMatch(/^https:\/\/www\.sim\.ai\//)
262+
})
248263
})

0 commit comments

Comments
 (0)