-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createFake, type Seed } from '@seamapi/fake-seam-connect' | ||
import type { ExecutionContext } from 'ava' | ||
|
||
export const getTestServer = async ( | ||
t: ExecutionContext, | ||
): Promise<{ endpoint: string; seed: Seed }> => { | ||
const fake = await createFake() | ||
|
||
await fake.startServer() | ||
|
||
t.teardown(async () => { | ||
await fake.stopServer() | ||
}) | ||
|
||
const seed = await fake.seed() | ||
const endpoint = fake.serverUrl | ||
|
||
if (endpoint == null) throw new Error('Fake endpoint is null') | ||
const res = await fetch(`${endpoint}/health`) | ||
if (!res.ok) throw new Error('Fake Seam Connect unhealthy') | ||
|
||
return { | ||
endpoint, | ||
seed, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import test from 'ava' | ||
import { getTestServer } from 'fixtures/seam/connect/api.js' | ||
|
||
import { SeamHttp } from '@seamapi/http/connect' | ||
|
||
test('SeamHttp: fromApiKey', async (t) => { | ||
const { seed, endpoint } = await getTestServer(t) | ||
const client = SeamHttp.fromApiKey(seed.seam_apikey1_token, { endpoint }) | ||
const workspace = await client.devices.get({ | ||
device_id: seed.august_device_1, | ||
}) | ||
t.is(workspace.workspace_id, seed.seed_workspace_1) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters