Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into MAT-6824_highlightFailedTe…
Browse files Browse the repository at this point in the history
…stCases
  • Loading branch information
CeciliaLiu8 committed Mar 29, 2024
2 parents d7c2134 + 397a9d5 commit f31ad66
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from '../src/export.module';
import { ExportModule } from '../src/export.module';

describe('AppController (e2e)', () => {
let app: INestApplication;

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
imports: [ExportModule],
}).compile();

app = moduleFixture.createNestApplication();
Expand All @@ -17,8 +17,23 @@ describe('AppController (e2e)', () => {

it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.get('/excel')
.set(
'authorization',
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.kcPmFlSUdC9LvuMufomQepInu3GwbBKKct49e2dxyrI',
)
.expect(200)
.expect('Hello World!');
.expect(
'Content-Type',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
);
});

it('/ (GET) unauthorized', () => {
return request(app.getHttpServer()).get('/excel').expect(401).expect({
message: 'Token not present',
error: 'Unauthorized',
statusCode: 401,
});
});
});

0 comments on commit f31ad66

Please sign in to comment.