Skip to content

Commit

Permalink
feat(core): expose witness set function to UI (#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
iFergal authored Dec 13, 2024
1 parent cd53be8 commit 5d6cdc1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/core/agent/services/identifierService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,4 +870,25 @@ describe("Single sig service of agent", () => {
expect(identifierService.deleteIdentifier).toHaveBeenCalledWith("id1");
expect(identifierService.deleteIdentifier).toHaveBeenCalledWith("id2");
});

test("cannot get available witnesses list if the config is misconfigured", async () => {
getAgentConfigMock.mockResolvedValueOnce({});

await expect(
identifierService.getAvailableWitnesses()
).rejects.toThrowError(IdentifierService.MISCONFIGURED_AGENT_CONFIGURATION);
expect(getAgentConfigMock).toBeCalled();
});

test("can get available witnesses list", async () => {
getAgentConfigMock.mockResolvedValueOnce({
iurls: [
"http://witnesess:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller",
WITNESSES[1]
],
});

expect(await identifierService.getAvailableWitnesses()).toStrictEqual([witnessEids[1]]);
expect(getAgentConfigMock).toBeCalled();
});
});
2 changes: 1 addition & 1 deletion src/core/agent/services/identifierService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ class IdentifierService extends AgentService {
}
}

private async getAvailableWitnesses(): Promise<string[]> {
async getAvailableWitnesses(): Promise<string[]> {
const config = await this.props.signifyClient.config().get();
if (!config.iurls) {
throw new Error(IdentifierService.MISCONFIGURED_AGENT_CONFIGURATION);
Expand Down

0 comments on commit 5d6cdc1

Please sign in to comment.