-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
fb09840
commit 98225fd
Showing
6 changed files
with
80 additions
and
17 deletions.
There are no files selected for viewing
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
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,32 @@ | ||
import { createExecutionContext, env, waitOnExecutionContext } from "cloudflare:test"; | ||
import { describe, expect, it } from "vitest"; | ||
import { VERSIONS } from "../../utils/versioning"; | ||
import worker from "../../worker"; | ||
import { Env } from "../../../worker-configuration"; | ||
|
||
const LOCAL_BASE_URL = 'http://localhost:8787' | ||
const SERVICES_BASE_URL = 'https://services.kukai.app' | ||
|
||
const ENDPOINTS_TO_TEST = [ | ||
`${VERSIONS.V1}explore`, | ||
`${VERSIONS.V2}explore`, | ||
] | ||
|
||
describe("compares explore to production", () => { | ||
ENDPOINTS_TO_TEST.forEach((endpoint) => { | ||
it(`tests ${endpoint}`, async () => { | ||
const localRequest = new Request(`${LOCAL_BASE_URL}${endpoint}`) | ||
const externalRequest = fetch(`${SERVICES_BASE_URL}${endpoint}`) | ||
|
||
const ctx = createExecutionContext() | ||
const localResponse = await worker.fetch(localRequest, env as Env, ctx) | ||
const externalResponse = await externalRequest | ||
await waitOnExecutionContext(ctx) | ||
|
||
const localJsonResponse = await localResponse.json() as any | ||
Check failure on line 26 in src/explore/__tests__/explore.test.ts GitHub Actions / Deploysrc/explore/__tests__/explore.test.ts > compares explore to production > tests /v2/explore
|
||
const externalJsonResponse = await externalResponse.json() as any | ||
|
||
expect(localJsonResponse.data).toEqual(externalJsonResponse.data) | ||
}) | ||
}) | ||
}) |
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
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,11 @@ | ||
import { defineWorkersConfig } from "@cloudflare/vitest-pool-workers/config"; | ||
|
||
export default defineWorkersConfig({ | ||
test: { | ||
poolOptions: { | ||
workers: { | ||
wrangler: { configPath: "./wrangler.toml" }, | ||
}, | ||
}, | ||
}, | ||
}); |