style: apply standard ESLint & Prettier formatting across backend
Deploy Canina / deploy (push) Successful in 4m58s
Deploy Canina / deploy (push) Successful in 4m58s
This commit is contained in:
1 parent
ae636c8b03
commit
62bd8811fa
66 files changed
+1398
-607
No files matched your search
@@ -8,9 +8,13 @@ describe('UsersController', () => {
|
||||
|
||||
const mockUsersService = {
|
||||
findById: jest.fn().mockResolvedValue({ id: 'user-id', firstName: 'Test' }),
|
||||
update: jest.fn().mockResolvedValue({ id: 'user-id', firstName: 'Updated' }),
|
||||
update: jest
|
||||
.fn()
|
||||
.mockResolvedValue({ id: 'user-id', firstName: 'Updated' }),
|
||||
addAddress: jest.fn().mockResolvedValue({ id: 'addr-id', title: 'Home' }),
|
||||
updateAddress: jest.fn().mockResolvedValue({ id: 'addr-id', title: 'Work' }),
|
||||
updateAddress: jest
|
||||
.fn()
|
||||
.mockResolvedValue({ id: 'addr-id', title: 'Work' }),
|
||||
deleteAddress: jest.fn().mockResolvedValue({ success: true }),
|
||||
setDefaultAddress: jest.fn().mockResolvedValue({ success: true }),
|
||||
};
|
||||
@@ -18,9 +22,7 @@ describe('UsersController', () => {
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [UsersController],
|
||||
providers: [
|
||||
{ provide: UsersService, useValue: mockUsersService },
|
||||
],
|
||||
providers: [{ provide: UsersService, useValue: mockUsersService }],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<UsersController>(UsersController);
|
||||
@@ -78,7 +80,11 @@ describe('UsersController', () => {
|
||||
zipCode: '123',
|
||||
};
|
||||
const result = await controller.updateAddress(req, 'addr-id', dto);
|
||||
expect(service.updateAddress).toHaveBeenCalledWith('user-id', 'addr-id', dto);
|
||||
expect(service.updateAddress).toHaveBeenCalledWith(
|
||||
'user-id',
|
||||
'addr-id',
|
||||
dto,
|
||||
);
|
||||
expect(result.title).toBe('Work');
|
||||
});
|
||||
|
||||
@@ -92,7 +98,10 @@ describe('UsersController', () => {
|
||||
it('should setDefaultAddress', async () => {
|
||||
const req = { user: { id: 'user-id' } };
|
||||
const result = await controller.setDefaultAddress(req, 'addr-id');
|
||||
expect(service.setDefaultAddress).toHaveBeenCalledWith('user-id', 'addr-id');
|
||||
expect(service.setDefaultAddress).toHaveBeenCalledWith(
|
||||
'user-id',
|
||||
'addr-id',
|
||||
);
|
||||
expect(result).toBeDefined();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user