Skip to content

Commit

Permalink
test(prisma): Adjust the number of retries
Browse files Browse the repository at this point in the history
  • Loading branch information
xcfox committed Nov 17, 2024
1 parent cdefdac commit 08bbe70
Showing 1 changed file with 35 additions and 39 deletions.
74 changes: 35 additions & 39 deletions packages/prisma/test/bobbin.spec.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { describe, it, expect, expectTypeOf, beforeAll } from "vitest"
import * as g from "./generated"
import { type InferSilkO, loom, weave } from "@gqloom/core"
import { asInputArgs, zodSilk } from "@gqloom/zod"
import { PrismaClient } from "@prisma/client"
import { printSchema, printType } from "graphql"
import { createYoga } from "graphql-yoga"
import { beforeAll, describe, expect, expectTypeOf, it } from "vitest"
import { z } from "zod"
import {
type InferPrismaDelegate,
PrismaModelBobbin,
type PrismaModelSilk,
} from "../src"
import { type InferSilkO, loom, weave } from "@gqloom/core"
import { zodSilk, asInputArgs } from "@gqloom/zod"
import { z } from "zod"
import { createYoga } from "graphql-yoga"
import { printSchema, printType } from "graphql"
import * as g from "./generated"

const { resolver, query } = loom

Expand Down Expand Up @@ -125,16 +125,14 @@ describe("PrismaModelBobbin", () => {
`)
})

it(
"should be able to resolve a relationField",
async () => {
const response = await yoga.fetch("http://localhost/graphql", {
method: "POST",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
query: /* GraphQL */ `
it("should be able to resolve a relationField", { retry: 20 }, async () => {
const response = await yoga.fetch("http://localhost/graphql", {
method: "POST",
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
query: /* GraphQL */ `
query {
users {
name
Expand All @@ -150,28 +148,26 @@ describe("PrismaModelBobbin", () => {
}
}
`,
}),
})

if (response.status !== 200) throw new Error("unexpected")
const json = await response.json()
expect(json).toMatchObject({
data: {
users: [
{
name: "John",
posts: [{ title: "Hello World" }, { title: "Hello GQLoom" }],
},
],
posts: [
{ title: "Hello World", author: { name: "John" } },
{ title: "Hello GQLoom", author: { name: "John" } },
],
},
})
},
{ retry: 6 }
)
}),
})

if (response.status !== 200) throw new Error("unexpected")
const json = await response.json()
expect(json).toMatchObject({
data: {
users: [
{
name: "John",
posts: [{ title: "Hello World" }, { title: "Hello GQLoom" }],
},
],
posts: [
{ title: "Hello World", author: { name: "John" } },
{ title: "Hello GQLoom", author: { name: "John" } },
],
},
})
})
})

describe("countQuery", () => {
Expand Down

0 comments on commit 08bbe70

Please sign in to comment.