diff --git a/packages/nestjs-auth-jwt/src/auth-jwt.strategy.spec.ts b/packages/nestjs-auth-jwt/src/auth-jwt.strategy.spec.ts index b06ff62e2..188443ac8 100644 --- a/packages/nestjs-auth-jwt/src/auth-jwt.strategy.spec.ts +++ b/packages/nestjs-auth-jwt/src/auth-jwt.strategy.spec.ts @@ -50,7 +50,7 @@ describe(AuthJwtStrategy, () => { const t = async () => { await authJwtStrategy.validate(authorizationPayload); }; - expect(t).rejects.toThrow(UnauthorizedException); + await expect(t).rejects.toThrow(UnauthorizedException); }); }); }); diff --git a/packages/nestjs-auth-local/src/auth-local.strategy.spec.ts b/packages/nestjs-auth-local/src/auth-local.strategy.spec.ts index 51ffff57b..32e20f1f4 100644 --- a/packages/nestjs-auth-local/src/auth-local.strategy.spec.ts +++ b/packages/nestjs-auth-local/src/auth-local.strategy.spec.ts @@ -62,14 +62,14 @@ describe(AuthLocalStrategy, () => { it('should throw error on validateOrReject', async () => { const t = () => authLocalStrategy.validate(USERNAME, ''); - expect(t).rejects.toThrow(); + await expect(t).rejects.toThrow(); }); it('should return no user on userLookupService.byUsername', async () => { jest.spyOn(userLookUpService, 'byUsername').mockResolvedValue(null); const t = () => authLocalStrategy.validate(USERNAME, PASSWORD); - expect(t).rejects.toThrow(UnauthorizedException); + await expect(t).rejects.toThrow(UnauthorizedException); }); it('should be invalid on passwordService.validateObject', async () => { @@ -78,7 +78,7 @@ describe(AuthLocalStrategy, () => { .mockResolvedValue(false); const t = () => authLocalStrategy.validate(USERNAME, PASSWORD); - expect(t).rejects.toThrow(UnauthorizedException); + await expect(t).rejects.toThrow(UnauthorizedException); }); }); diff --git a/packages/nestjs-auth-refresh/src/auth-refresh.strategy.spec.ts b/packages/nestjs-auth-refresh/src/auth-refresh.strategy.spec.ts index bd401cae5..150e909b8 100644 --- a/packages/nestjs-auth-refresh/src/auth-refresh.strategy.spec.ts +++ b/packages/nestjs-auth-refresh/src/auth-refresh.strategy.spec.ts @@ -64,7 +64,7 @@ describe(AuthRefreshStrategy, () => { const t = () => authRefreshStrategy.validate(authorizationPayloadInterface); - expect(t).rejects.toThrow(UnauthorizedException); + await expect(t).rejects.toThrow(UnauthorizedException); }); }); }); diff --git a/packages/nestjs-authentication/src/services/verify-token.service.spec.ts b/packages/nestjs-authentication/src/services/verify-token.service.spec.ts index a97981b25..1c654d5c2 100644 --- a/packages/nestjs-authentication/src/services/verify-token.service.spec.ts +++ b/packages/nestjs-authentication/src/services/verify-token.service.spec.ts @@ -32,7 +32,7 @@ describe(VerifyTokenService, () => { const t = async () => { await verifyTokenService.accessToken(token); }; - expect(t).rejects.toThrow(BadRequestException); + await expect(t).rejects.toThrow(BadRequestException); }); }); @@ -57,7 +57,7 @@ describe(VerifyTokenService, () => { const t = async () => { await verifyTokenService.refreshToken(token); }; - expect(t).rejects.toThrow(BadRequestException); + await expect(t).rejects.toThrow(BadRequestException); }); }); }); diff --git a/packages/nestjs-event/src/services/event-dispatch.service.spec.ts b/packages/nestjs-event/src/services/event-dispatch.service.spec.ts index ca6129f0a..c036bb3c5 100644 --- a/packages/nestjs-event/src/services/event-dispatch.service.spec.ts +++ b/packages/nestjs-event/src/services/event-dispatch.service.spec.ts @@ -142,7 +142,7 @@ describe(EventDispatchService, () => { eventEmitter.on(testEvent.key, listener); - expect(eventDispatchService.async(testEvent)).rejects.toThrowError( + await expect(eventDispatchService.async(testEvent)).rejects.toThrowError( EventDispatchException, ); }); diff --git a/packages/nestjs-jwt/src/jwt.strategy.spec.ts b/packages/nestjs-jwt/src/jwt.strategy.spec.ts index ff4f7ec74..168b13a9f 100644 --- a/packages/nestjs-jwt/src/jwt.strategy.spec.ts +++ b/packages/nestjs-jwt/src/jwt.strategy.spec.ts @@ -29,7 +29,7 @@ describe(JwtStrategy, () => { it('should throw exception', async () => { jest.spyOn(jwtStrategyOptions, 'jwtFromRequest').mockReturnValue(''); const t = async () => await jwtStrategy.authenticate(req); - expect(t).rejects.toThrow(); + await expect(t).rejects.toThrow(); }); it('should throw exception', async () => { @@ -39,7 +39,7 @@ describe(JwtStrategy, () => { throw new Error(); }); const t = async () => await jwtStrategy.authenticate(req); - expect(t).rejects.toThrow(); + await expect(t).rejects.toThrow(); }); it('should throw exception', async () => { @@ -49,17 +49,17 @@ describe(JwtStrategy, () => { throw new NotAnErrorException(new Error()); }); const t = async () => await jwtStrategy.authenticate(req); - expect(t).rejects.toThrow(); + await expect(t).rejects.toThrow(); }); it('should throw exception', async () => { const t = async () => jwtStrategy['verifyTokenCallback'](); - expect(t).rejects.toThrow(); + await expect(t).rejects.toThrow(); }); it('should throw exception', async () => { const t = async () => jwtStrategy['verifyTokenCallback'](new Error()); - expect(t).rejects.toThrow(); + await expect(t).rejects.toThrow(); }); // it('should throw exception', async () => { diff --git a/packages/nestjs-jwt/src/services/jwt-issue.service.spec.ts b/packages/nestjs-jwt/src/services/jwt-issue.service.spec.ts index c678c9dd2..633d9dde7 100644 --- a/packages/nestjs-jwt/src/services/jwt-issue.service.spec.ts +++ b/packages/nestjs-jwt/src/services/jwt-issue.service.spec.ts @@ -24,7 +24,7 @@ describe(JwtIssueService, () => { throw new Error(); }); const t = async () => await jwtIssueService.accessToken(token); - expect(t).rejects.toThrowError(); + await expect(t).rejects.toThrowError(); }); }); @@ -43,7 +43,7 @@ describe(JwtIssueService, () => { throw new Error(); }); const t = async () => await jwtIssueService.refreshToken(token); - expect(t).rejects.toThrowError(); + await expect(t).rejects.toThrowError(); }); }); }); diff --git a/packages/nestjs-jwt/src/services/jwt-sign.service.spec.ts b/packages/nestjs-jwt/src/services/jwt-sign.service.spec.ts index ea3322523..10133bd12 100644 --- a/packages/nestjs-jwt/src/services/jwt-sign.service.spec.ts +++ b/packages/nestjs-jwt/src/services/jwt-sign.service.spec.ts @@ -32,7 +32,7 @@ describe(JwtSignService, () => { throw new Error(); }); const t = async () => await jwtSignService.signAsync(access, token); - expect(t).rejects.toThrowError(); + await expect(t).rejects.toThrowError(); }); }); @@ -51,7 +51,7 @@ describe(JwtSignService, () => { throw new Error(); }); const t = async () => await jwtSignService.verifyAsync(access, token); - expect(t).rejects.toThrowError(); + await expect(t).rejects.toThrowError(); }); }); @@ -67,7 +67,7 @@ describe(JwtSignService, () => { throw new Error(); }); const t = async () => await jwtSignService.decode(access, token); - expect(t).rejects.toThrowError(); + await expect(t).rejects.toThrowError(); }); }); diff --git a/packages/nestjs-jwt/src/services/jwt-verify.service.spec.ts b/packages/nestjs-jwt/src/services/jwt-verify.service.spec.ts index f64d9a852..b959eaeed 100644 --- a/packages/nestjs-jwt/src/services/jwt-verify.service.spec.ts +++ b/packages/nestjs-jwt/src/services/jwt-verify.service.spec.ts @@ -24,7 +24,7 @@ describe(JwtVerifyService, () => { throw new Error(); }); const t = async () => await jwtVerifyService.accessToken(token); - expect(t).rejects.toThrowError(); + await expect(t).rejects.toThrowError(); }); }); @@ -43,7 +43,7 @@ describe(JwtVerifyService, () => { throw new Error(); }); const t = async () => await jwtVerifyService.refreshToken(token); - expect(t).rejects.toThrowError(); + await expect(t).rejects.toThrowError(); }); }); }); diff --git a/packages/nestjs-password/src/services/password-storage.service.spec.ts b/packages/nestjs-password/src/services/password-storage.service.spec.ts index 89bccd129..ffefed49d 100644 --- a/packages/nestjs-password/src/services/password-storage.service.spec.ts +++ b/packages/nestjs-password/src/services/password-storage.service.spec.ts @@ -178,8 +178,8 @@ describe(PasswordStorageService, () => { await storageService.hashObject({}, { required: true }); }; - expect(t).rejects.toThrow(Error); - expect(t).rejects.toThrow( + await expect(t).rejects.toThrow(Error); + await expect(t).rejects.toThrow( 'Password is required for hashing, but non was provided.', ); }); diff --git a/packages/typeorm-common/src/services/lookup.service.spec.ts b/packages/typeorm-common/src/services/lookup.service.spec.ts index 1238230e7..ea342454a 100644 --- a/packages/typeorm-common/src/services/lookup.service.spec.ts +++ b/packages/typeorm-common/src/services/lookup.service.spec.ts @@ -77,7 +77,7 @@ describe(LookupService, () => { throw new Error(); }); - expect(testLookupService['findOne']({})).rejects.toThrow( + await expect(testLookupService['findOne']({})).rejects.toThrow( ReferenceLookupException, ); }); diff --git a/packages/typeorm-common/src/services/mutate.service.spec.ts b/packages/typeorm-common/src/services/mutate.service.spec.ts index d82eafe5a..37012d093 100644 --- a/packages/typeorm-common/src/services/mutate.service.spec.ts +++ b/packages/typeorm-common/src/services/mutate.service.spec.ts @@ -77,7 +77,7 @@ describe(MutateService, () => { return testMutateService.create({ firstName: 'Bob' }); }; - expect(t).rejects.toThrow(ReferenceMutateException); + await expect(t).rejects.toThrow(ReferenceMutateException); }); it('invalid', async () => { @@ -85,7 +85,7 @@ describe(MutateService, () => { return testMutateService.create({ firstName: 'B' }); }; - expect(t).rejects.toThrow(ReferenceValidationException); + await expect(t).rejects.toThrow(ReferenceValidationException); }); }); @@ -113,7 +113,7 @@ describe(MutateService, () => { }); }; - expect(t()).rejects.toThrow(ReferenceIdNoMatchException); + await expect(t()).rejects.toThrow(ReferenceIdNoMatchException); }); it('found but not valid', async () => { @@ -125,7 +125,7 @@ describe(MutateService, () => { }); }; - expect(t).rejects.toThrow(ReferenceValidationException); + await expect(t).rejects.toThrow(ReferenceValidationException); }); it('found, valid, but exception on save', async () => { @@ -143,7 +143,7 @@ describe(MutateService, () => { }); }; - expect(t).rejects.toThrow(ReferenceMutateException); + await expect(t).rejects.toThrow(ReferenceMutateException); }); }); @@ -184,7 +184,7 @@ describe(MutateService, () => { }); }; - expect(t).rejects.toThrow(ReferenceIdNoMatchException); + await expect(t).rejects.toThrow(ReferenceIdNoMatchException); }); it('found but not valid', async () => { @@ -197,7 +197,7 @@ describe(MutateService, () => { }); }; - expect(t).rejects.toThrow(ReferenceValidationException); + await expect(t).rejects.toThrow(ReferenceValidationException); }); it('found, valid, but exception on save', async () => { @@ -216,7 +216,7 @@ describe(MutateService, () => { }); }; - expect(t).rejects.toThrow(ReferenceMutateException); + await expect(t).rejects.toThrow(ReferenceMutateException); }); }); @@ -234,7 +234,7 @@ describe(MutateService, () => { return testMutateService['findById'](testObject.id); }; - expect(t).rejects.toThrow(ReferenceIdNoMatchException); + await expect(t).rejects.toThrow(ReferenceIdNoMatchException); }); it('id does not match', async () => { @@ -244,7 +244,7 @@ describe(MutateService, () => { }); }; - expect(t).rejects.toThrow(ReferenceIdNoMatchException); + await expect(t).rejects.toThrow(ReferenceIdNoMatchException); }); it('exception', async () => { @@ -260,7 +260,7 @@ describe(MutateService, () => { throw new Error(); }); - expect(t).rejects.toThrow(ReferenceMutateException); + await expect(t).rejects.toThrow(ReferenceMutateException); }); }); @@ -278,7 +278,7 @@ describe(MutateService, () => { throw new Error(); }); - expect(t).rejects.toThrow(ReferenceLookupException); + await expect(t).rejects.toThrow(ReferenceLookupException); }); }); });