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

fix: dedicated session ack tests #2176

Merged
merged 2 commits into from
Apr 4, 2023
Merged
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
11 changes: 11 additions & 0 deletions packages/sign-client/test/sdk/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ describe("Sign Client Integration", () => {
});
await deleteClients(clients);
});
it("should receive session acknowledge", async () => {
const clients = await initTwoClients();
const {
sessionA: { topic, acknowledged },
} = await testConnectMethod(clients);
await throttle(5_000);
const session = clients.B.session.get(topic);
expect(session.acknowledged).to.be.true;
expect(acknowledged).to.be.true;
await deleteClients(clients);
});
});

describe("disconnect", () => {
Expand Down
6 changes: 0 additions & 6 deletions packages/sign-client/test/shared/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ export async function testConnectMethod(clients: Clients, params?: TestConnectPa
sessionB = await acknowledged();
expect(sessionB.acknowledged).to.be.false;
}
// with the optimistic resolve of acknowledged(), we need to wait for the session to be updated
await throttle(1_000);
sessionB = clients.B.session.get(sessionB.topic);
expect(sessionB.acknowledged).to.be.true;
resolve();
} catch (e) {
reject(e);
Expand Down Expand Up @@ -169,8 +165,6 @@ export async function testConnectMethod(clients: Clients, params?: TestConnectPa
expect(sessionA.sessionProperties).to.eql(TEST_SESSION_PROPERTIES_APPROVE);
// expiry
expect(Math.abs(sessionA.expiry - sessionB.expiry)).to.be.lessThan(5);
// acknowledged
expect(sessionA.acknowledged).to.eql(sessionB.acknowledged);
// participants
expect(sessionA.self).to.eql(sessionB.peer);
expect(sessionA.peer).to.eql(sessionB.self);
Expand Down