Skip to content

Commit

Permalink
Remove "apollo-server-testing" based on the comments at apollographql…
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriharpf committed May 22, 2021
1 parent d23cb8e commit a35b842
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ query Posts {
- [Apollo Server](https://github.com/apollographql/apollo-server)
- [Bootstrapping code to start the server](https://typegraphql.com/docs/bootstrap.html)
- Example resolvers and [Apollo REST Data Source](https://www.npmjs.com/package/apollo-datasource-rest)s (posts, users)
- Test infrastructure ([ts-jest](https://github.com/kulshekhar/ts-jest), [apollo-server-testing](https://www.apollographql.com/docs/apollo-server/testing/testing/) and [nock](https://www.npmjs.com/package/nock)) and example tests
- Test infrastructure ([ts-jest](https://github.com/kulshekhar/ts-jest) and [nock](https://www.npmjs.com/package/nock)) with example tests
- [ts-node-dev](https://www.npmjs.com/package/ts-node-dev) for development (restarts app when code changes)
- [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md) with [type-aware rules](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/TYPED_LINTING.md)
- Github: Dependabot dependency updates
Expand Down
25 changes: 0 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@types/jest": "^26.0.23",
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"apollo-server-testing": "^2.24.0",
"eslint": "^7.26.0",
"eslint-plugin-jest": "^24.3.6",
"jest": "^26.6.3",
Expand Down
8 changes: 4 additions & 4 deletions src/posts/post-resolver.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import nock from "nock";
import { gql } from "apollo-server";
import { createServer } from "../create-server";
import { createTestClient } from "apollo-server-testing";
import { print } from "graphql";

describe("PostResolver", () => {
it("returns all posts", async () => {
Expand All @@ -27,9 +27,9 @@ describe("PostResolver", () => {
]);

const server = await createServer();
// eslint-disable-next-line jest/unbound-method
const { query } = createTestClient(server);
const response = await query({ query: postsQuery });
const response = await server.executeOperation({
query: print(postsQuery),
});

expect(response.errors).toBeUndefined();
expect(response.data).toEqual({
Expand Down
20 changes: 8 additions & 12 deletions src/users/user-resolver.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { gql } from "apollo-server";
import { createTestClient } from "apollo-server-testing";
import nock from "nock";
import { print } from "graphql";
import { createServer } from "../create-server";

describe("UserResolver", () => {
Expand All @@ -27,9 +27,9 @@ describe("UserResolver", () => {
]);

const server = await createServer();
// eslint-disable-next-line jest/unbound-method
const { query } = createTestClient(server);
const response = await query({ query: usersQuery });
const response = await server.executeOperation({
query: print(usersQuery),
});

expect(response.errors).toBeUndefined();
expect(response.data).toEqual({
Expand All @@ -55,10 +55,8 @@ describe("UserResolver", () => {
});

const server = await createServer();
// eslint-disable-next-line jest/unbound-method
const { query } = createTestClient(server);
const response = await query({
query: userQuery,
const response = await server.executeOperation({
query: print(userQuery),
variables: { userId: "1" },
});

Expand Down Expand Up @@ -100,10 +98,8 @@ describe("UserResolver", () => {
]);

const server = await createServer();
// eslint-disable-next-line jest/unbound-method
const { query } = createTestClient(server);
const response = await query({
query: userQueryWithPosts,
const response = await server.executeOperation({
query: print(userQueryWithPosts),
variables: { userId: "1" },
});

Expand Down

0 comments on commit a35b842

Please sign in to comment.