Skip to content

Commit

Permalink
update unit test multiSigService
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotatek-TungNguyen2a committed Dec 13, 2024
1 parent 97af93f commit f104bfb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core/__fixtures__/agent/multSigFixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const getMemberIdentifierResponse = {
},
di: "",
},
icp_dt: "2024-08-09T07:23:52.839894+00:00"
};

const getMultisigIdentifierResponse = {
Expand Down
3 changes: 3 additions & 0 deletions src/core/agent/services/identifierService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,10 @@ class IdentifierService extends AgentService {
throw error;
});
const identifier = operation.serder.ked.i;

// @TODO - foconnor: Need update HabState interface on signify.
const identifierDetail = await this.props.signifyClient.identifiers().get(identifier) as HabState & { icp_dt: string };

const addRoleOperation = await this.props.signifyClient
.identifiers()
.addEndRole(identifier, "agent", this.props.signifyClient.agent!.pre);
Expand Down
30 changes: 29 additions & 1 deletion src/core/agent/services/multiSigService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ describe("Oobi/endrole", () => {
);
expect(addEndRoleMock).toBeCalledTimes(1);
(memberMetadataRecord.groupMetadata as any).groupCreated = false;

expect(identifierStorage.createIdentifierMetadataRecord).toBeCalledWith(
{
id: "newMultisigIdentifierAid",
displayName: "Identifier 2",
theme: 0,
isPending: false,
multisigManageAid: "creatorIdentifier",
createdAt: new Date("2024-08-09T07:23:52.839894+00:00")
}
)
});

test("Can add end role authorization", async () => {
Expand Down Expand Up @@ -406,7 +417,14 @@ describe("Creation of multi-sig", () => {
isPending: true,
});
expect(identifierStorage.createIdentifierMetadataRecord).toBeCalledWith(
expect.objectContaining({ id: multisigIdentifier, isPending: true })
expect.objectContaining({
id: multisigIdentifier,
displayName: "Identifier 2",
theme: 0,
isPending: true,
multisigManageAid: "creatorIdentifier",
createdAt: new Date("2024-08-09T07:23:52.839Z")
})
);

expect(eventEmitter.emit).toHaveBeenCalledWith({
Expand Down Expand Up @@ -446,6 +464,11 @@ describe("Creation of multi-sig", () => {
expect(identifierStorage.createIdentifierMetadataRecord).toBeCalledWith(
expect.objectContaining({
id: `${multisigIdentifier}1`,
displayName: "Identifier 2",
theme: 0,
isPending: true,
multisigManageAid: "creatorIdentifier",
createdAt: new Date("2024-08-09T07:23:52.839Z")
})
);

Expand Down Expand Up @@ -477,6 +500,11 @@ describe("Creation of multi-sig", () => {
expect(identifierStorage.createIdentifierMetadataRecord).toBeCalledWith(
expect.objectContaining({
id: `${multisigIdentifier}2`,
displayName: "Identifier 2",
theme: 0,
isPending: true,
multisigManageAid: "creatorIdentifier",
createdAt: new Date("2024-08-09T07:23:52.839Z")
})
);

Expand Down

0 comments on commit f104bfb

Please sign in to comment.