Skip to content

Commit

Permalink
Update to CalledWith
Browse files Browse the repository at this point in the history
  • Loading branch information
nakedmcse committed Mar 29, 2024
1 parent 3d50a24 commit 7ae2dce
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/services/__test__/unit/AdminService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("unit tests", () => {
await adminService.getStatsData([]);

// then
expect(statsSpy).toHaveBeenCalled();
expect(statsSpy).toHaveBeenCalledWith([]);
}),
);
});
Expand All @@ -59,7 +59,7 @@ describe("unit tests", () => {
const retval = await adminService.getAllEntries();

// then
expect(fileSpy).toHaveBeenCalled();
expect(fileSpy).toHaveBeenCalledWith();
expect(retval.length).equal(2);
},
),
Expand All @@ -82,7 +82,7 @@ describe("unit tests", () => {
const retval = await adminService.getPagedEntries(1, 10, "id", "ASC", "test search");

// then
expect(fileSpy).toHaveBeenCalled();
expect(fileSpy).toHaveBeenCalledWith(1, 10, "id", "ASC", "test search");
expect(retval.length).equal(2);
},
),
Expand Down Expand Up @@ -139,7 +139,7 @@ describe("unit tests", () => {
await adminService.getAllBlockedIps();

// then
expect(blackListSpy).toHaveBeenCalled();
expect(blackListSpy).toHaveBeenCalledWith();
},
),
);
Expand All @@ -161,7 +161,7 @@ describe("unit tests", () => {
await adminService.blockIp("1.1.1.1", false);

// then
expect(blackListSpy).toHaveBeenCalled();
expect(blackListSpy).toHaveBeenCalledWith("1.1.1.1");
expect(processDeleteSpy).not.toHaveBeenCalled();
},
),
Expand Down Expand Up @@ -191,8 +191,11 @@ describe("unit tests", () => {

// then
expect(fileRepoSpy).toHaveBeenCalled();
expect(blackListSpy).toHaveBeenCalled();
expect(processDeleteSpy).toHaveBeenCalled();
expect(blackListSpy).toHaveBeenCalledWith("1.1.1.1");
expect(processDeleteSpy).toHaveBeenCalledWith([
fileUploadModelMock500MB.token,
fileUploadModelMockCustomExpire.token,
]);
},
),
);
Expand All @@ -211,7 +214,7 @@ describe("unit tests", () => {
await adminService.removeBlockedIps(["1.1.1.1", "2.2.2.2"]);

// then
expect(blackListSpy).toHaveBeenCalled();
expect(blackListSpy).toHaveBeenCalledWith(["1.1.1.1", "2.2.2.2"]);
},
),
);
Expand All @@ -233,8 +236,11 @@ describe("unit tests", () => {
await adminService.deleteEntries([100, 101]);

// then
expect(getAllEntriesSpy).toHaveBeenCalled();
expect(processDeleteSpy).toHaveBeenCalled();
expect(getAllEntriesSpy).toHaveBeenCalledWith([100, 101]);
expect(processDeleteSpy).toHaveBeenCalledWith([
fileUploadModelMock500MB.token,
fileUploadModelMockCustomExpire.token,
]);
},
),
);
Expand Down

0 comments on commit 7ae2dce

Please sign in to comment.