Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
SDK version
Using Lit JS SDK (master branch commit 412264b.)
Lit Network
This issue is for unit testing , so not
Description of the bug/issue
The test should correctly create the ACC
in packages/wrapped-keys/src/lib/api/utils.spec.ts
expects an array with a single ACC object, but the actual getPkpAccessControlCondition
function returns a plain object (not an array). This causes:
FAIL types packages/wrapped-keys/src/lib/api/utils.spec.ts
● getPkpAccessControlCondition › should correctly create the ACC
expect(received).toEqual(expected) // deep equality
Expected: [{"chain": "ethereum", "contractAddress": "", "method": "", "parameters": [":userAddress"], "returnValueTest": {"comparator": "=", "value": "0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}, "standardContractType": ""}]
Received: {"chain": "ethereum", "contractAddress": "", "method": "", "parameters": [":userAddress"], "returnValueTest": {"comparator": "=", "value": "0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}, "standardContractType": ""}
88 | const pkpAddress = '0xd1Af1AAC50aC837C873200D17b78664aFCde597C';
89 | const acc = getPkpAccessControlCondition(pkpAddress);
> 90 | expect(acc).toEqual([
| ^
91 | {
92 | contractAddress: '',
93 | standardContractType: '',
at Object.<anonymous> (src/lib/api/utils.spec.ts:90:17)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 failed, 12 passed, 13 total
Snapshots: 0 total
Time: 2.563 s
Ran all test suites.
Severity of the bug
This breaks the test suite out-of-the-box, causing CI to fail unless the code or test is adjusted.
Steps To Reproduce
npx nx run wrapped-keys:test
- The test fails with the mismatch: expected array vs actual object.
Link to code
Anything else?
Proposed fix:
- Either update the implementation of
getPkpAccessControlCondition
to return an array (like[ {...} ]
), or modify the test to expect an object. - Considering that other ACC usage patterns might rely on an array, it’s probably safer to return an array from the implementation for consistency.
Metadata
Metadata
Assignees
Labels
No labels