Skip to content

Commit

Permalink
fix [agent module] -> type errors in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadyazdanii committed Jul 13, 2023
1 parent 4c15387 commit 99035a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
15 changes: 7 additions & 8 deletions src/agent/test/agent.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,9 @@ describe('Agent Controller', () => {
let ticket;

beforeEach(async () => {
ticket = await controller.changeTicketStatus(
String(ticketStub()._id),
ticketStub().status,
);
ticket = await controller.changeTicketStatus(String(ticketStub()._id), {
status: ticketStub().status,
});
});

test('then it should call changeTicketStatus service', () => {
Expand Down Expand Up @@ -207,14 +206,14 @@ describe('Agent Controller', () => {
};

agent = await controller.updateAgent(
agentStub('operator')._id,
String(agentStub('operator')._id),
updateAgentDTOStub,
);
});

test('then it should call updateAgent service', () => {
expect(agentService.updateAgent).toBeCalledWith(
agentStub('operator')._id,
String(agentStub('operator')._id),
updateAgentDTOStub,
);
});
Expand All @@ -228,12 +227,12 @@ describe('Agent Controller', () => {
let agent;

beforeEach(async () => {
agent = await controller.removeAgent(agentStub('operator')._id);
agent = await controller.removeAgent(String(agentStub('operator')._id));
});

test('then it should call deleteAgent service', () => {
expect(agentService.deleteAgent).toBeCalledWith(
agentStub('operator')._id,
String(agentStub('operator')._id),
);
});

Expand Down
6 changes: 3 additions & 3 deletions src/agent/test/agent.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Agent Service', () => {
let agent_id: string;

beforeEach(async () => {
agent_id = agentStub('operator')._id;
agent_id = String(agentStub('operator')._id);

jest
.spyOn(repository, 'findOne')
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('Agent Service', () => {
let updateAgentDto: UpdateAgentDTO;

beforeEach(async () => {
agent_id = agentStub('operator')._id;
agent_id = String(agentStub('operator')._id);

updateAgentDto = {
email_address: agentStub('operator').email_address,
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('Agent Service', () => {
let agent_id: string;

beforeEach(async () => {
agent_id = agentStub('operator')._id;
agent_id = String(agentStub('operator')._id);

jest
.spyOn(repository, 'deleteOne')
Expand Down

0 comments on commit 99035a6

Please sign in to comment.