Skip to content

Commit 8832874

Browse files
committed
fix: unit test
1 parent f6192f3 commit 8832874

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/__tests__/utils.test.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
getSessionDomain,
2121
getSessionTypedData,
2222
createSession,
23+
createSessionRequest,
2324
} from "../utils"
2425

2526
type WalletMock = Pick<StarknetWindowObject, "request">
@@ -159,15 +160,25 @@ describe("Utils", () => {
159160
sessionKey,
160161
}
161162

162-
const accountSessionSignature = await createSession({
163-
address: "0x1234567890abcdef",
164-
authorisationSignature: ["0x123", "0x456"],
163+
const sessionRequest = createSessionRequest({
164+
chainId,
165165
sessionParams,
166+
})
167+
168+
const authorisationSignature = await walletMock.request({
169+
type: "wallet_signTypedData",
170+
params: sessionRequest.sessionTypedData,
171+
})
172+
173+
const session = await createSession({
174+
address: "0x1234567890abcdef",
175+
authorisationSignature,
176+
sessionRequest,
166177
chainId,
167178
})
168179

169-
expect(accountSessionSignature).not.toBeNull()
170-
expect(accountSessionSignature).toStrictEqual({
180+
expect(session).not.toBeNull()
181+
expect(session).toStrictEqual({
171182
sessionKeyGuid:
172183
"0x4bef97e579cdb4c9fa3546db3017a69ddbc40598cd7311359f1e6c03f02b155",
173184
hash: "0x87f8341a9fb39398e15dec07024475dd96406fe4880b9a24d10fb9e6bbf6bd",

0 commit comments

Comments
 (0)