Skip to content

Commit

Permalink
fix: add tests
Browse files Browse the repository at this point in the history
Signed-off-by: wambuipixel <[email protected]>
  • Loading branch information
wambui-pixel committed Nov 26, 2024
1 parent 9439e92 commit 8432b7e
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 54 deletions.
18 changes: 9 additions & 9 deletions tests/bootstrap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("Bootstraps", () => {
fetchMock.resetMocks();
});

test("AddBootstrap should create a Bootstrap Configuration and return success", async () => {
test("Add bootstrap should create a bootstrap configuration", async () => {
const createResponse = {
status: 200,
message: "Bootstrap configuration created",
Expand All @@ -54,7 +54,7 @@ describe("Bootstraps", () => {
expect(response).toEqual(createResponse);
});

test("Whitelist should allow a user to update a Bootstrap Configuration and return success", async () => {
test("Whitelist should allow a user to update a bootstrap configuration", async () => {
const whitelistResponse = {
status: 200,
message: "Bootstrap configuration state updated successfully",
Expand All @@ -65,7 +65,7 @@ describe("Bootstraps", () => {
expect(response).toEqual(whitelistResponse);
});

test("UpdateBootstrap should allow a user to update a Bootstrap Configuration and return success", async () => {
test("Update bootstrap should allow a user to update a bootstrap configuration", async () => {
const updateResponse = {
status: 200,
message: "Bootstrap configuration updated successfully",
Expand All @@ -80,7 +80,7 @@ describe("Bootstraps", () => {
expect(response).toEqual(updateResponse);
});

test("ViewBootstrap should allow a user to view a Bootstrap Configuration and return success", async () => {
test("View bootstrap should allow a user to view a bootstrap configuration", async () => {
fetchMock.mockResponseOnce(JSON.stringify(bootstrap));

const response = await sdk.bootstrap.ViewBootstrap(
Expand All @@ -91,7 +91,7 @@ describe("Bootstraps", () => {
expect(response).toEqual(bootstrap);
});

test("UpdateBootstrapCerts should update certs of a bootstrap configuration and return success", async () => {
test("Update bootstrap certs should update certs of a bootstrap configuration", async () => {
fetchMock.mockResponseOnce(JSON.stringify(bootstrap));

const response = await sdk.bootstrap.UpdateBootstrapCerts(
Expand All @@ -102,7 +102,7 @@ describe("Bootstraps", () => {
expect(response).toEqual(bootstrap);
});

test("DeleteBootstrap should allow a user to view a Bootstrap Configuration and return success", async () => {
test("Delete bootstrap should allow a user to view a bootstrap configuration", async () => {
const deleteResponse = {
status: 200,
message: "Bootstrap configuration deleted",
Expand All @@ -117,14 +117,14 @@ describe("Bootstraps", () => {
expect(response).toEqual(deleteResponse);
});

test("Bootstrap should retrive a Bootstrap Configuration and return success", async () => {
test("Bootstrap should retrive a bootstrap configuration", async () => {
fetchMock.mockResponseOnce(JSON.stringify(bootstrap));

const response = await sdk.bootstrap.Bootstrap(externalId, externalKey);
expect(response).toEqual(bootstrap);
});

test("Bootstraps should retrive all bootstraps and return success", async () => {
test("Bootstraps should retrive all bootstraps", async () => {
fetchMock.mockResponseOnce(JSON.stringify(bootstrapPage));

const response = await sdk.bootstrap.Bootstraps(
Expand All @@ -135,7 +135,7 @@ describe("Bootstraps", () => {
expect(response).toEqual(bootstrapPage);
});

test("UpdateBootstrapConnection should retrive all bootstraps and return success", async () => {
test("Update bootstrap connection should retrive all bootstraps", async () => {
const connResponse = {
status: 200,
message: "Bootstrap connection successful",
Expand Down
12 changes: 6 additions & 6 deletions tests/invitations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Invitations", () => {
fetchMock.resetMocks();
});

test("send invitation should send an invitation and return success", async () => {
test("Send invitation should send an invitation", async () => {
const SendInvitationResponse = {
status: 200,
message: "Invitation sent successfully",
Expand All @@ -48,21 +48,21 @@ describe("Invitations", () => {
expect(response).toEqual(SendInvitationResponse);
});

test("invitation should return an invitation and return success", async () => {
test("Invitation should return an invitation", async () => {
fetchMock.mockResponseOnce(JSON.stringify(invitation));

const response = await sdk.invitations.Invitation(userId, domainId, token);
expect(response).toEqual(invitation);
});

test("invitations should return a list of invitations and return success", async () => {
test("Invitations should return a list of invitations", async () => {
fetchMock.mockResponseOnce(JSON.stringify(invitationsPage));

const response = await sdk.invitations.Invitations(queryParams, token);
expect(response).toEqual(invitationsPage);
});

test("accept invitation should accept an invitation and return success", async () => {
test("Accept invitation should accept an invitation", async () => {
const AcceptInvitationResponse = {
status: 200,
message: "Invitation accepted successfully",
Expand All @@ -73,7 +73,7 @@ describe("Invitations", () => {
expect(response).toEqual(AcceptInvitationResponse);
});

test("reject invitation should reject an invitation and return success", async () => {
test("Reject invitation should reject an invitation", async () => {
const RejectInvitationResponse = {
status: 200,
message: "Invitation rejected successfully",
Expand All @@ -84,7 +84,7 @@ describe("Invitations", () => {
expect(response).toEqual(RejectInvitationResponse);
});

test("delete invitation should delete an invitation and return success", async () => {
test("Delete invitation should delete an invitation", async () => {
const DeleteInvitationResponse = {
status: 200,
message: "Invitation deleted successfully",
Expand Down
2 changes: 1 addition & 1 deletion tests/journal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("Journal", () => {
fetchMock.resetMocks();
});

test("journal should return a list of journals and return success", async () => {
test("journal should return a list of journals ", async () => {
fetchMock.mockResponseOnce(JSON.stringify(journalsPage));

const response = await sdk.Journal.Journal(
Expand Down
4 changes: 2 additions & 2 deletions tests/messages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe("Messages", () => {
fetchMock.resetMocks();
});

test("Send should send a message and return success", async () => {
test("Send should send a message", async () => {
fetchMock.mockResponseOnce(
JSON.stringify({ status: 200, message: "Message sent successfully" }),
);
Expand All @@ -52,7 +52,7 @@ describe("Messages", () => {
});
});

test("Read should read messages and return success", async () => {
test("Read should read messages", async () => {
fetchMock.mockResponseOnce(JSON.stringify(messagesPage));

const response = await sdk.messages.Read(
Expand Down
28 changes: 14 additions & 14 deletions tests/roles.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ describe("Roles", () => {
fetchMock.resetMocks();
});

test("ListAvailableActions should return available actions", async () => {
test("List available actions should return available actions", async () => {
const availableActions = ["read", "write", "delete"];
fetchMock.mockResponseOnce(JSON.stringify(availableActions));

const response = await roles.ListAvailableActions(baseUrl, endpoint, token);
expect(response).toEqual(availableActions);
});

test("CreateRole should create a new role and return it", async () => {
test("Create role should create a new role and return it", async () => {
fetchMock.mockResponseOnce(JSON.stringify(role));

const response = await roles.CreateRole(
Expand All @@ -43,7 +43,7 @@ describe("Roles", () => {
expect(response).toEqual(role);
});

test("ListRoles should return a page of roles", async () => {
test("List roles should return a page of roles", async () => {
const rolesPage = { roles: [role], total: 1, offset: 0, limit: 10 };
fetchMock.mockResponseOnce(JSON.stringify(rolesPage));

Expand All @@ -57,7 +57,7 @@ describe("Roles", () => {
expect(response).toEqual(rolesPage);
});

test("ViewRole should return details of a specific role", async () => {
test("View role should return details of a specific role", async () => {
fetchMock.mockResponseOnce(JSON.stringify(role));

const response = await roles.ViewRole(
Expand All @@ -70,7 +70,7 @@ describe("Roles", () => {
expect(response).toEqual(role);
});

test("UpdateRole should update a role and return the updated role", async () => {
test("Update role should update a role and return the updated role", async () => {
const updatedRole = { ...role, actions: [...actions, "execute"] };
fetchMock.mockResponseOnce(JSON.stringify(updatedRole));

Expand All @@ -85,7 +85,7 @@ describe("Roles", () => {
expect(response).toEqual(updatedRole);
});

test("DeleteRole should delete a role and return success response", async () => {
test("Delete role should delete a role response", async () => {
const successResponse = {
status: 200,
message: "Role deleted successfully",
Expand All @@ -102,7 +102,7 @@ describe("Roles", () => {
expect(response).toEqual(successResponse);
});

test("AddRoleActions should add actions to a role and return updated actions", async () => {
test("Add role actions should add actions to a role and return updated actions", async () => {
const updatedActions = [...actions, "execute"];
fetchMock.mockResponseOnce(JSON.stringify(updatedActions));

Expand All @@ -117,7 +117,7 @@ describe("Roles", () => {
expect(response).toEqual(updatedActions);
});

test("ListRoleActions should return actions of a specific role", async () => {
test("List role actions should return actions of a specific role", async () => {
fetchMock.mockResponseOnce(JSON.stringify(actions));

const response = await roles.ListRoleActions(
Expand All @@ -130,7 +130,7 @@ describe("Roles", () => {
expect(response).toEqual(actions);
});

test("DeleteRoleActions should remove actions from a role and return success response", async () => {
test("Delete role actions should remove actions from a role response", async () => {
const successResponse = {
status: 200,
message: "Role actions deleted successfully",
Expand All @@ -148,7 +148,7 @@ describe("Roles", () => {
expect(response).toEqual(successResponse);
});

test("DeleteAllRoleActions should remove all actions from a role and return success response", async () => {
test("Delete all role actions should remove all actions from a role response", async () => {
const successResponse = {
status: 200,
message: "Role actions deleted successfully",
Expand All @@ -165,7 +165,7 @@ describe("Roles", () => {
expect(response).toEqual(successResponse);
});

test("AddRoleMembers should add members to a role and return updated members", async () => {
test("Add role members should add members to a role and return updated members", async () => {
const updatedMembers = [...members, "user3"];
fetchMock.mockResponseOnce(JSON.stringify(updatedMembers));

Expand All @@ -180,7 +180,7 @@ describe("Roles", () => {
expect(response).toEqual(updatedMembers);
});

test("ListRoleMembers should return members of a specific role", async () => {
test("List role members should return members of a specific role", async () => {
fetchMock.mockResponseOnce(JSON.stringify(members));

const response = await roles.ListRoleMembers(
Expand All @@ -194,7 +194,7 @@ describe("Roles", () => {
expect(response).toEqual(members);
});

test("DeleteRoleMembers should remove members from a role and return success response", async () => {
test("Delete role members should remove members from a role response", async () => {
const successResponse = {
status: 200,
message: "Role members deleted successfully",
Expand All @@ -212,7 +212,7 @@ describe("Roles", () => {
expect(response).toEqual(successResponse);
});

test("DeleteAllRoleMembers should remove all members from a role and return success response", async () => {
test("Delete all role members should remove all members from a role response", async () => {
const successResponse = {
status: 200,
message: "Role members deleted successfully",
Expand Down
Loading

0 comments on commit 8432b7e

Please sign in to comment.