Skip to content

Commit 604c90f

Browse files
committed
refactor: remove unused imports and commented-out test cases in user.controller.spec.ts
1 parent 01fa389 commit 604c90f

File tree

1 file changed

+0
-57
lines changed

1 file changed

+0
-57
lines changed
Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import { HttpException } from '@nestjs/common';
21
import { Test, TestingModule } from '@nestjs/testing';
3-
import { PageQueryDTO } from '@shared/validation/common/dto/PageQuery.dto';
4-
import { GetUser } from '@shared/validation/user/dto/GetUser.dto';
52

6-
import type { UserDocument } from './entity/user.entity';
73
import { UserController } from './user.controller';
84
import { UserService } from './user.service';
95

@@ -35,57 +31,4 @@ describe('UserController', () => {
3531
it('should be defined', () => {
3632
expect(userController).toBeDefined();
3733
});
38-
39-
describe('getUser', () => {
40-
it('should return user data by email or ID', async () => {
41-
const query: GetUser = {
42-
43-
username: 'test-username',
44-
id: 'test-id',
45-
};
46-
47-
const user = { email: '[email protected]' };
48-
49-
mockUserService.getUserByEmailOrId.mockResolvedValueOnce(user);
50-
51-
const result = await userController.getUser(query);
52-
53-
expect(result).toEqual(user);
54-
expect(userService.getUserByEmailOrId).toHaveBeenCalledWith(query);
55-
});
56-
});
57-
58-
describe('getUserPaginated', () => {
59-
it('should return paginated user data', async () => {
60-
const query: PageQueryDTO = { page: 1, limit: 10 };
61-
const paginatedUsers = { items: [], total: 0 };
62-
63-
mockUserService.getUserPaginated.mockResolvedValueOnce(paginatedUsers);
64-
65-
const result = await userController.getUserPaginated(query);
66-
67-
expect(result).toEqual(paginatedUsers);
68-
expect(userService.getUserPaginated).toHaveBeenCalledWith(query);
69-
});
70-
});
71-
72-
describe('getMe', () => {
73-
it('should return the token owner data', async () => {
74-
const user: UserDocument = { _id: 'test-user-id' } as UserDocument;
75-
const userData = { _id: 'test-user-id', email: '[email protected]' };
76-
77-
mockUserService.getSelfUserData.mockResolvedValueOnce(userData);
78-
79-
const result = await userController.getMe(user);
80-
81-
expect(result).toEqual(userData);
82-
expect(userService.getSelfUserData).toHaveBeenCalledWith(user);
83-
});
84-
85-
it('should handle null user', async () => {
86-
const user = null;
87-
88-
await expect(userController.getMe(user)).rejects.toThrow(HttpException);
89-
});
90-
});
9134
});

0 commit comments

Comments
 (0)