-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
843a911
commit 98fcbd4
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { MockProxy, mock } from "jest-mock-extended"; | ||
|
||
import { ApiService } from "@bitwarden/common/abstractions/api.service"; | ||
import { OrganizationId } from "@bitwarden/common/types/guid"; | ||
import { SecurityTaskStatus } from "@bitwarden/vault"; | ||
|
||
import { DefaultAdminTaskService } from "./default-admin-task.service"; | ||
describe("DefaultAdminTaskService", () => { | ||
let defaultAdminTaskService: DefaultAdminTaskService; | ||
let apiService: MockProxy<ApiService>; | ||
|
||
beforeEach(() => { | ||
apiService = mock<ApiService>(); | ||
defaultAdminTaskService = new DefaultAdminTaskService(apiService); | ||
}); | ||
|
||
describe("getAllTasks", () => { | ||
it("should call the api service with the correct parameters", async () => { | ||
const organizationId = "orgId" as OrganizationId; | ||
const status = SecurityTaskStatus.Pending; | ||
const expectedUrl = `/tasks/organization?organizationId=${organizationId}&status=0`; | ||
|
||
await defaultAdminTaskService.getAllTasks(organizationId, status); | ||
|
||
expect(apiService.send).toHaveBeenCalledWith("GET", expectedUrl, null, true, true); | ||
}); | ||
}); | ||
}); |