Skip to content

Commit 9bb0829

Browse files
committed
Add fromClient test
1 parent 784ef62 commit 9bb0829

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/seam/connect/client.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import test from 'ava'
2+
import { getTestServer } from 'fixtures/seam/connect/api.js'
3+
4+
import { SeamHttp } from '@seamapi/http/connect'
5+
6+
test('SeamHttp: fromClient returns instance that uses client', async (t) => {
7+
const { seed, endpoint } = await getTestServer(t)
8+
const client = SeamHttp.fromClient(
9+
SeamHttp.fromApiKey(seed.seam_apikey1_token, { endpoint }).client,
10+
)
11+
const device = await client.devices.get({
12+
device_id: seed.august_device_1,
13+
})
14+
t.is(device.workspace_id, seed.seed_workspace_1)
15+
t.is(device.device_id, seed.august_device_1)
16+
})
17+
18+
test('SeamHttp: constructor returns instance that uses client', async (t) => {
19+
const { seed, endpoint } = await getTestServer(t)
20+
const client = new SeamHttp({
21+
client: SeamHttp.fromApiKey(seed.seam_apikey1_token, { endpoint }).client,
22+
})
23+
const device = await client.devices.get({
24+
device_id: seed.august_device_1,
25+
})
26+
t.is(device.workspace_id, seed.seed_workspace_1)
27+
t.is(device.device_id, seed.august_device_1)
28+
})

0 commit comments

Comments
 (0)