Skip to content

Commit a20550f

Browse files
committed
add test to validate the signer callback is called
1 parent f29c9f2 commit a20550f

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

test/unit/base/auth.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,23 @@ describe("building authorization entries", () => {
130130
);
131131
});
132132

133+
it("invokes the signing callback", async () => {
134+
// the callback only records that it ran; the assertion lives in the test
135+
// body (after the await), never inside the callback
136+
let invoked = false;
137+
await authorizeEntry(
138+
authEntry,
139+
(preimage) => {
140+
invoked = true;
141+
return Promise.resolve(kp.sign(hash(preimage.toXDR())));
142+
},
143+
10,
144+
Networks.TESTNET,
145+
);
146+
147+
expect(invoked).toBe(true);
148+
});
149+
133150
it("returns entry unchanged for source account credentials (no-op)", async () => {
134151
const sourceAccountEntry = new xdr.SorobanAuthorizationEntry({
135152
rootInvocation: authEntry.rootInvocation(),

0 commit comments

Comments
 (0)