Skip to content

Commit 251cbb5

Browse files
committed
fix: failing tests
1 parent 06356c2 commit 251cbb5

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

apps/web/src/lib/query-builder/where-clause-autocomplete.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe("where clause autocomplete", () => {
2828
})
2929

3030
expect(result.context).toBe("operator")
31-
expect(result.suggestions.map((item) => item.insertText)).toEqual(["=", "contains"])
31+
expect(result.suggestions.map((item) => item.insertText)).toEqual(["=", ">", "<", ">=", "<=", "contains", "exists"])
3232
})
3333

3434
it("suggests values for the active key", () => {

packages/domain/src/tinybird/project-sync.test.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,26 @@ describe("Tinybird project sync", () => {
1717
let requestBody: FormData | null = null
1818
let authorizationHeader = ""
1919

20-
globalThis.fetch = mock(async (_input: RequestInfo | URL, init?: RequestInit) => {
21-
authorizationHeader = String(init?.headers instanceof Headers ? init.headers.get("Authorization") : (init?.headers as Record<string, string> | undefined)?.Authorization ?? "")
22-
requestBody = init?.body as FormData
20+
globalThis.fetch = mock(async (input: RequestInfo | URL, init?: RequestInit) => {
21+
const isRequest = input instanceof Request
22+
const url = typeof input === "string" ? input : input instanceof URL ? input.toString() : input.url
23+
const method = init?.method ?? (isRequest ? input.method : "GET")
24+
const headers = init?.headers instanceof Headers
25+
? init.headers
26+
: isRequest
27+
? input.headers
28+
: new Headers(init?.headers as HeadersInit | undefined)
29+
authorizationHeader = headers.get("Authorization") ?? ""
30+
31+
// Stale deployment cleanup call
32+
if (url.includes("/v1/deployments") && method === "GET") {
33+
return new Response(JSON.stringify({ deployments: [] }), {
34+
status: 200,
35+
headers: { "content-type": "application/json" },
36+
})
37+
}
38+
39+
requestBody = (init?.body ?? (isRequest ? input.body : null)) as FormData
2340

2441
return new Response(
2542
JSON.stringify({

0 commit comments

Comments
 (0)