Skip to content

Commit d65da5d

Browse files
committed
fix(e2e): reorder balance check and sponsorship removal in payment delegation test
1 parent 7ded797 commit d65da5d

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

packages/e2e/src/e2e.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ describe('all', () => {
172172

173173
it('eoaNativeAuthFlow', () => createEoaNativeAuthFlowTest(ctx)());
174174
});
175-
});
176175

177-
if (process.env['NETWORK'] !== 'naga-dev') {
178-
describe('paid networks only', () => {
179-
registerPaymentDelegationTicketSuite();
180-
});
181-
}
176+
if (process.env['NETWORK'] !== 'naga-dev') {
177+
describe('paid networks only', () => {
178+
registerPaymentDelegationTicketSuite();
179+
});
180+
}
181+
});
182182
});

packages/e2e/src/tickets/delegation.suite.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,26 +72,12 @@ export function registerPaymentDelegationTicketSuite() {
7272
userMaxPrice: 1000000000000000000n, // 0.05 ETH in Wei
7373
});
7474

75-
// 4. Finally, check that Alice's Ledger balance has decreased
76-
const aliceBalanceAfter = await testEnv.masterPaymentManager.getBalance({
77-
userAddress: alice.account.address,
78-
});
79-
80-
console.log(
81-
"[AFTER] Alice's Ledger balance after Bob's request:",
82-
aliceBalanceAfter
83-
);
84-
85-
expect(BigInt(aliceBalanceAfter.raw.availableBalance)).toBeLessThan(
86-
BigInt(aliceBeforeBalance.raw.availableBalance)
87-
);
88-
89-
// 5. Now, Alice removes Bob from her sponsorship
75+
// 4. Now, Alice removes Bob from her sponsorship
9076
await alice.paymentManager!.undelegatePaymentsBatch({
9177
userAddresses: [bobAccount.account.address],
9278
});
9379

94-
// 6. Bob should now fail to sign with his PKP due to lack of sponsorship
80+
// 5. Bob should now fail to sign with his PKP due to lack of sponsorship
9581
let didFail = false;
9682
try {
9783
await testEnv.litClient.chain.ethereum.pkpSign({
@@ -109,6 +95,20 @@ export function registerPaymentDelegationTicketSuite() {
10995
}
11096

11197
expect(didFail).toBe(true);
98+
99+
// 6. Finally, check that Alice's Ledger balance has decreased
100+
const aliceBalanceAfter = await testEnv.masterPaymentManager.getBalance({
101+
userAddress: alice.account.address,
102+
});
103+
104+
console.log(
105+
"[AFTER] Alice's Ledger balance after Bob's request:",
106+
aliceBalanceAfter
107+
);
108+
109+
expect(BigInt(aliceBalanceAfter.raw.availableBalance)).toBeLessThan(
110+
BigInt(aliceBeforeBalance.raw.availableBalance)
111+
);
112112
});
113113
});
114114
}

0 commit comments

Comments
 (0)