test: add unit tests for messaging, comments, events, and user services
- Added comprehensive unit tests for `MessagesService`, `CommentsService`, `EventsGateway`, and enhancements in `UsersService`. - Ensured proper mocking and test coverage for newly introduced dependencies like `EventsGateway` and `RBACService`.
This commit is contained in:
@@ -108,6 +108,7 @@ describe("UsersService", () => {
|
||||
describe("findOne", () => {
|
||||
it("should find a user", async () => {
|
||||
mockUsersRepository.findOne.mockResolvedValue({ uuid: "uuid1" });
|
||||
mockRbacService.getUserRoles.mockResolvedValue([]);
|
||||
const result = await service.findOne("uuid1");
|
||||
expect(result.uuid).toBe("uuid1");
|
||||
});
|
||||
@@ -139,6 +140,7 @@ describe("UsersService", () => {
|
||||
describe("findByEmailHash", () => {
|
||||
it("should call repository.findByEmailHash", async () => {
|
||||
mockUsersRepository.findByEmailHash.mockResolvedValue({ uuid: "u1" });
|
||||
mockRbacService.getUserRoles.mockResolvedValue([]);
|
||||
const result = await service.findByEmailHash("hash");
|
||||
expect(result.uuid).toBe("u1");
|
||||
expect(mockUsersRepository.findByEmailHash).toHaveBeenCalledWith("hash");
|
||||
|
||||
Reference in New Issue
Block a user