Skip to content

Commit

Permalink
fix(resource): Fixed broken tests (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
clintonb authored Jan 5, 2024
1 parent 9aeacc1 commit c898b2c
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/lib/resource/resource.factory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,7 @@ describe('UserDto', () => {

it('should generate "Users" e2e spec file', () => {
expect(tree.readContent('/users/users.e2e.spec.ts')).toEqual(
`import { faker } from '@faker-js/faker';
import { INestApplication, Injectable } from '@nestjs/common';
`import { INestApplication } from '@nestjs/common';
import { instanceToPlain } from 'class-transformer';
import { orderBy, times } from 'lodash';
import request from 'supertest';
Expand All @@ -350,7 +349,6 @@ import { APIBannerUser } from '@vori/types/User';
import { makeAndSaveBanner } from '@vori/utils/VoriRandom/Banner.random';
import { configureApp } from '@vori/nest/bootstrap';
import { FirebaseAuthStrategy } from '@vori/nest/libs/auth/firebase-auth.strategy';
import {
createAnnotatedUser,
createE2ETestingModule,
Expand All @@ -375,24 +373,14 @@ describe('/v1/users', () => {
let user: APIBannerUser | undefined;
let usersService: UsersService;
@Injectable()
class MockFirebaseAuthStrategy extends FirebaseAuthStrategy {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
async validate(token): Promise<APIBannerUser | undefined> {
return user;
}
}
beforeAll(async () => {
mockTemporalSetupAndShutdown();
const moduleRef = await createE2ETestingModule({
// TODO Remember to import UsersModule into AppModule
imports: [AppModule],
})
.overrideProvider(FirebaseAuthStrategy)
.useClass(MockFirebaseAuthStrategy)
.mockAuthentication(() => user)
.compile();
app = moduleRef.createNestApplication();
Expand Down

0 comments on commit c898b2c

Please sign in to comment.