Skip to content

Commit 2e3f962

Browse files
committed
chore: more schema-driven-testing edits
1 parent 4124a9f commit 2e3f962

File tree

5 files changed

+117
-115
lines changed

5 files changed

+117
-115
lines changed

apollo-client/v3/schema-driven-testing/package-lock.json

+79-79
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apollo-client/v3/schema-driven-testing/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,28 @@
3030
"@graphql-tools/utils": "10.1.3",
3131
"@jest/globals": "29.7.0",
3232
"@testing-library/jest-dom": "6.4.2",
33-
"@testing-library/react": "15.0.2",
33+
"@testing-library/react": "15.0.4",
3434
"@testing-library/user-event": "14.5.2",
3535
"@types/jest": "29.5.12",
3636
"@types/react": "18.2.79",
3737
"@types/react-dom": "18.2.25",
38-
"@typescript-eslint/eslint-plugin": "7.7.0",
39-
"@typescript-eslint/parser": "7.7.0",
38+
"@typescript-eslint/eslint-plugin": "7.7.1",
39+
"@typescript-eslint/parser": "7.7.1",
4040
"@vitejs/plugin-react": "4.2.1",
4141
"eslint": "8.56.0",
4242
"eslint-plugin-react-hooks": "4.6.0",
4343
"eslint-plugin-react-refresh": "0.4.6",
4444
"jest": "29.7.0",
4545
"jest-environment-jsdom": "29.7.0",
4646
"jsdom": "24.0.0",
47-
"msw": "2.2.10",
47+
"msw": "2.2.14",
4848
"prettier": "3.2.5",
4949
"ts-jest": "29.1.2",
5050
"ts-jest-resolver": "2.0.1",
5151
"ts-node": "10.9.2",
5252
"typescript": "5.4.5",
53-
"undici": "6.13.0",
54-
"vite": "5.2.9",
53+
"undici": "6.14.1",
54+
"vite": "5.2.10",
5555
"vite-plugin-graphql-loader": "3.0.1"
5656
}
5757
}

apollo-client/v3/schema-driven-testing/src/__tests__/jest/products.test.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const schema = createTestSchema(staticSchema, {
2020
resolvers: {
2121
Query: {
2222
products: () =>
23-
new Array(5).fill(null).map((_, i) => ({
24-
id: i,
25-
mediaUrl: `https://example.com/image${i}.jpg`,
23+
Array.from({ length: 5 }, (_element, id) => ({
24+
id,
25+
mediaUrl: `https://example.com/image${id}.jpg`,
2626
})),
2727
},
2828
},
@@ -51,14 +51,14 @@ describe("Products", () => {
5151
await screen.findByText("Loading...");
5252

5353
// title is rendering the default string scalar
54-
const findAllByText = await screen.findAllByText("default string");
54+
const findAllByText = await screen.findAllByText(/default string/);
5555
expect(findAllByText).toHaveLength(5);
5656

5757
// the products resolver is returning 5 products
58-
await screen.findByText("0 - https://example.com/image0.jpg");
59-
await screen.findByText("1 - https://example.com/image1.jpg");
60-
await screen.findByText("2 - https://example.com/image2.jpg");
61-
await screen.findByText("3 - https://example.com/image3.jpg");
62-
await screen.findByText("4 - https://example.com/image4.jpg");
58+
await screen.findByText(/0/);
59+
await screen.findByText(/1/);
60+
await screen.findByText(/2/);
61+
await screen.findByText(/3/);
62+
await screen.findByText(/4/);
6363
});
6464
});

0 commit comments

Comments
 (0)