Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kopy-kat committed Oct 15, 2024
1 parent 5b188f5 commit b238db5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/module/smart-sessions/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ export const getEnableSessionDetails = async ({
signature: '0x' as Hex,
enableSessionData: {
enableSession: {
chainDigestIndex: 0,
chainDigestIndex: sessionIndex || 0,
hashesAndChainIds: chainDigests,
sessionToEnable,
permissionEnableSig: '0x' as Hex,
Expand Down
3 changes: 0 additions & 3 deletions test/unit/module/smartSessions/smartSessionPolicies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ describe('Smart Sessions Polices', () => {
UNIVERSAL_ACTION_POLICY_ADDRESS,
)
expect(installUniversalPolicy.initData).toBeDefined()
expect(installUniversalPolicy.deInitData).toEqual('0x')
})

// -----------------------
Expand All @@ -48,7 +47,6 @@ describe('Smart Sessions Polices', () => {
const installSudoActionPolicy = getSudoPolicy()
expect(installSudoActionPolicy.address).toBeDefined()
expect(installSudoActionPolicy.initData).toEqual('0x')
expect(installSudoActionPolicy.deInitData).toEqual('0x')
})

// -----------------------
Expand All @@ -61,6 +59,5 @@ describe('Smart Sessions Polices', () => {

expect(installSpendingLimitPolicy.address).toBeDefined()
expect(installSpendingLimitPolicy.initData).toBeDefined()
expect(installSpendingLimitPolicy.deInitData).toEqual('0x')
})
})
12 changes: 11 additions & 1 deletion test/unit/module/smartSessions/smartSessionsValidator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
getPermissionId,
} from 'src/module/smart-sessions'
import { privateKeyToAccount, generatePrivateKey } from 'viem/accounts'
import { mainnet } from 'viem/chains'
import { mainnet, sepolia } from 'viem/chains'
import { getPublicClient } from 'test/utils/userOps/clients'
import {
encodeValidationData,
Expand All @@ -42,6 +42,7 @@ describe('Smart Sessions Polices', () => {
allowedERC7739Content: [],
erc1271Policies: [],
},
chainId: BigInt(sepolia.id),
},
]

Expand Down Expand Up @@ -104,6 +105,7 @@ describe('Smart Sessions Polices', () => {
allowedERC7739Content: [],
erc1271Policies: [],
},
chainId: BigInt(sepolia.id),
}

const permissionId = getPermissionId({
Expand Down Expand Up @@ -159,6 +161,9 @@ describe('Smart Sessions Polices', () => {
account,
})

decodedSig.enableSessionData!.enableSession.sessionToEnable.chainId =
BigInt(sepolia.id)

expect(decodedSig.mode).toEqual(SmartSessionMode.ENABLE)
expect(decodedSig.permissionId).toEqual(permissionId)
expect(decodedSig.signature).toEqual(signature)
Expand Down Expand Up @@ -212,6 +217,7 @@ describe('Smart Sessions Polices', () => {
allowedERC7739Content: [],
erc1271Policies: [],
},
chainId: BigInt(sepolia.id),
}
const permissionId = getPermissionId({
session,
Expand Down Expand Up @@ -266,6 +272,9 @@ describe('Smart Sessions Polices', () => {
account,
})

decodedSig.enableSessionData!.enableSession.sessionToEnable.chainId =
BigInt(sepolia.id)

expect(decodedSig.mode).toEqual(SmartSessionMode.ENABLE)
expect(decodedSig.permissionId).toEqual(permissionId)
expect(decodedSig.signature).toEqual(signature)
Expand Down Expand Up @@ -338,6 +347,7 @@ describe('Smart Sessions Polices', () => {
allowedERC7739Content: [],
erc1271Policies: [],
},
chainId: BigInt(sepolia.id),
}

const sessionDigest = keccak256(toHex('sessionDigest'))
Expand Down

0 comments on commit b238db5

Please sign in to comment.