test: rename variables and format multiline assertion in events gateway spec
- Renamed `jwtService` to `_jwtService` to align with conventions for unused test variables. - Adjusted multiline assertion formatting for improved readability.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
import { Test, TestingModule } from "@nestjs/testing";
|
||||
import { Server } from "socket.io";
|
||||
import { JwtService } from "../crypto/services/jwt.service";
|
||||
import { EventsGateway } from "./events.gateway";
|
||||
|
||||
describe("EventsGateway", () => {
|
||||
let gateway: EventsGateway;
|
||||
let jwtService: JwtService;
|
||||
let _jwtService: JwtService;
|
||||
|
||||
const mockJwtService = {
|
||||
verifyJwt: jest.fn(),
|
||||
@@ -26,7 +25,7 @@ describe("EventsGateway", () => {
|
||||
}).compile();
|
||||
|
||||
gateway = module.get<EventsGateway>(EventsGateway);
|
||||
jwtService = module.get<JwtService>(JwtService);
|
||||
_jwtService = module.get<JwtService>(JwtService);
|
||||
gateway.server = {
|
||||
to: jest.fn().mockReturnThis(),
|
||||
emit: jest.fn(),
|
||||
@@ -46,7 +45,10 @@ describe("EventsGateway", () => {
|
||||
gateway.sendToUser(userId, event, data);
|
||||
|
||||
expect(gateway.server.to).toHaveBeenCalledWith(`user:${userId}`);
|
||||
expect(gateway.server.to(`user:${userId}`).emit).toHaveBeenCalledWith(event, data);
|
||||
expect(gateway.server.to(`user:${userId}`).emit).toHaveBeenCalledWith(
|
||||
event,
|
||||
data,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user