Skip to content

Commit

Permalink
Merge pull request #133 from kauandotnet/hotfix/create-user-mutate-se…
Browse files Browse the repository at this point in the history
…rvice-provider

fix: validate options user mutate service
  • Loading branch information
MrMaz authored Oct 27, 2023
2 parents 9d61919 + e7556d1 commit 872592a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/nestjs-user/src/user.module-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ export function createUserMutateServiceProvider(
userRepo: Repository<UserEntityInterface>,
passwordStorageService: PasswordStorageService,
) =>
optionsOverrides?.userLookupService ??
options.userLookupService ??
optionsOverrides?.userMutateService ??
options.userMutateService ??
new UserMutateService(userRepo, passwordStorageService),
};
}
4 changes: 4 additions & 0 deletions packages/nestjs-user/src/user.module.custom.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing';
import { UserCrudService } from './services/user-crud.service';
import { UserMutateService } from './services/user-mutate.service';
import { UserController } from './user.controller';

import { AppModuleCustomFixture } from './__fixtures__/app.module.custom.fixture';
Expand All @@ -11,6 +12,7 @@ describe('AppModule', () => {
let userLookupService: UserLookupCustomService;
let userCrudService: UserCrudService;
let userController: UserController;
let userMutateService: UserMutateService;

beforeEach(async () => {
const testModule: TestingModule = await Test.createTestingModule({
Expand All @@ -23,6 +25,7 @@ describe('AppModule', () => {
userLookupService = testModule.get<UserLookupCustomService>(
UserLookupCustomService,
);
userMutateService = testModule.get<UserMutateService>(UserMutateService);
userCrudService = testModule.get<UserCrudService>(UserCrudService);
userController = testModule.get<UserController>(UserController);
});
Expand All @@ -35,6 +38,7 @@ describe('AppModule', () => {
it('should be loaded', async () => {
expect(userModule).toBeInstanceOf(UserModuleCustomFixture);
expect(userLookupService).toBeInstanceOf(UserLookupCustomService);
expect(userMutateService).toBeInstanceOf(UserMutateService);
expect(userCrudService).toBeInstanceOf(UserCrudService);
expect(userController).toBeInstanceOf(UserController);
});
Expand Down

0 comments on commit 872592a

Please sign in to comment.