Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistyped client call responses #266

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/api/app/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export class AppWebsocket implements AppClient {
`The app your connection token was issued for was not found. The app needs to be installed and enabled.`
);
}
appInfo.agent_pub_key = new AgentPubKey(appInfo.agent_pub_key);

return new AppWebsocket(
client,
Expand All @@ -254,6 +255,7 @@ export class AppWebsocket implements AppClient {
`App info not found. App needs to be installed and enabled.`
);
}
appInfo.agent_pub_key = new AgentPubKey(appInfo.agent_pub_key);

this.cachedAppInfo = appInfo;
return appInfo;
Expand Down
20 changes: 20 additions & 0 deletions test/e2e/app-websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
fakeAgentPubKey,
NonProvenanceCallZomeRequest,
RoleName,
AgentPubKey,
} from "../../src";
import {
createAppWsAndInstallApp,
Expand Down Expand Up @@ -311,3 +312,22 @@ test(
]);
})
);

test(
"can read myPubKey",
withConductor(ADMIN_PORT, async (t) => {
const {
installed_app_id,
cell_id,
client: appWs,
admin,
} = await createAppWsAndInstallApp(ADMIN_PORT);

const myPubKey = appWs.myPubKey;
const appInfo = await appWs.appInfo();

t.deepEqual(myPubKey, appInfo.agent_pub_key);
t.deepEqual(myPubKey.toString(), appInfo.agent_pub_key.toString());
t.deepEqual(myPubKey.toBytes(), appInfo.agent_pub_key.toBytes());
})
);
Loading