Skip to content

Commit

Permalink
chore: upgrade @nestjs/apollo and remove old apollo-server
Browse files Browse the repository at this point in the history
  • Loading branch information
9renpoto committed Mar 15, 2023
1 parent 8fc6cfb commit 0248b14
Show file tree
Hide file tree
Showing 10 changed files with 4,616 additions and 3,431 deletions.
31 changes: 0 additions & 31 deletions example/__tests__/__snapshots__/app.e2e-spec.ts.snap

This file was deleted.

15 changes: 10 additions & 5 deletions example/__tests__/app.e2e-spec.ts
@@ -1,15 +1,16 @@
import { Test, TestingModule } from '@nestjs/testing';
import * as request from 'supertest';
import request from 'supertest';
import { INestApplication } from '@nestjs/common';
import type { ApolloServerBase } from 'apollo-server-core';
import { ApolloServer } from '@apollo/server';
import gql from 'graphql-tag';
import { GraphQLError } from 'graphql';
import { AppModule } from './../src/app.module';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver } from '@nestjs/apollo';

describe('AppModule', () => {
let app: INestApplication;
let apolloClient: ApolloServerBase;
let apolloClient: ApolloServer;

beforeAll(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
Expand Down Expand Up @@ -41,7 +42,9 @@ describe('AppModule', () => {
`,
variables: {},
});
expect(result.errors).toMatchSnapshot();
expect(
result.body.kind === 'single' && result.body.singleResult.errors,
).toEqual([new GraphQLError('Unauthorized')]);
});

it('/graphql(POST) forbiddenError', async () => {
Expand All @@ -53,6 +56,8 @@ describe('AppModule', () => {
`,
variables: {},
});
expect(result.errors).toMatchSnapshot();
expect(
result.body.kind === 'single' && result.body.singleResult.errors,
).toEqual([new GraphQLError('Forbidden')]);
});
});
1 change: 0 additions & 1 deletion example/src/app.module.ts
Expand Up @@ -12,7 +12,6 @@ import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
GraphQLModule.forRoot<ApolloDriverConfig>({
driver: ApolloDriver,
autoSchemaFile: true,
debug: true,
playground: true,
}),
GqlModule,
Expand Down
6 changes: 3 additions & 3 deletions example/tsconfig.json
Expand Up @@ -4,11 +4,11 @@
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"target": "es6",
"sourceMap": true,
"outDir": "./dist",
"noEmit": true,
"incremental": true
},
"exclude": ["node_modules"]
"exclude": ["node_modules", "__tests__"]
}

0 comments on commit 0248b14

Please sign in to comment.