Skip to content

Commit

Permalink
fix(chai): fix chai assertion typing
Browse files Browse the repository at this point in the history
  • Loading branch information
oumar-fall committed Jan 15, 2025
1 parent 371b613 commit caa8198
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 37 deletions.
12 changes: 2 additions & 10 deletions packages/blue-migration-sdk-viem/test/e2e/aaveV2/supply.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,7 @@ describe("Supply position on AAVE V2", () => {
expect(bundlerPosition).eql(0n);
expect(wEthBundlerBalance).eql(0n);
expect(userPosition).gt(positionAmount - migratedAmount); //interest have been accumulated
expect(userMMBalance).approximately(
//TODO fix typescript
migratedAmount,
1n,
);
expect(userMMBalance).gte(migratedAmount - 2n);
},
);

Expand Down Expand Up @@ -398,11 +394,7 @@ describe("Supply position on AAVE V2", () => {
expect(bundlerPosition).eql(0n);
expect(wEthBundlerBalance).eql(0n);
expect(userPosition).gt(positionAmount - migratedAmount); //interest have been accumulated
expect(userMMBalance).approximately(
//TODO fix typescript
migratedAmount,
1n,
);
expect(userMMBalance).gte(migratedAmount - 2n);
},
);

Expand Down
12 changes: 2 additions & 10 deletions packages/blue-migration-sdk-viem/test/e2e/aaveV3/supply.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,7 @@ describe("Supply position on AAVE V3", () => {
expect(bundlerPosition).eql(0n);
expect(wEthBundlerBalance).eql(0n);
expect(userPosition).gt(positionAmount - migratedAmount); //interest have been accumulated
expect(userMMBalance).approximately(
//TODO fix typescript
migratedAmount,
1n,
);
expect(userMMBalance).gte(migratedAmount - 2n);
});

testFn("Should fully migrate user position", async ({ client }) => {
Expand Down Expand Up @@ -435,11 +431,7 @@ describe("Supply position on AAVE V3", () => {
expect(bundlerPosition).eql(0n);
expect(wEthBundlerBalance).eql(0n);
expect(userPosition).gt(positionAmount - migratedAmount); //interest have been accumulated
expect(userMMBalance).approximately(
//TODO fix typescript
migratedAmount,
1n,
);
expect(userMMBalance).gte(migratedAmount - 2n);
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,7 @@ describe("Supply position on Morpho AAVE V3", () => {

expect(wEthBundlerBalance).eql(0n);
expect(userPosition).gt(positionAmount - migratedAmount); //interest have been accumulated
expect(userMMBalance).approximately(
//TODO fix typescript
migratedAmount,
1n,
);
expect(userMMBalance).gte(migratedAmount - 2n);
},
);

Expand Down Expand Up @@ -436,11 +432,7 @@ describe("Supply position on Morpho AAVE V3", () => {

expect(wEthBundlerBalance).eql(0n);
expect(userPosition).gt(positionAmount - migratedAmount); //interest have been accumulated
expect(userMMBalance).approximately(
//TODO fix typescript
migratedAmount,
1n,
);
expect(userMMBalance).gte(migratedAmount - 2n);
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,11 @@ describe("Borrow position on blue", () => {
);
expect(finalPositionTo.collateral).equal(collateralToMigrate);
expect(finalPositionFrom.borrowShares).approximately(
//TODO fix typescript
initialPositionFrom.borrowShares -
finalPositionFrom.market.toBorrowShares(borrowToMigrate),
2n,
);
expect(finalPositionTo.borrowAssets).approximately(
//TODO fix typescript
borrowToMigrate,
2n,
);
expect(finalPositionTo.borrowAssets).approximately(borrowToMigrate, 2n);
});

testFn("should fully migrate borrow position", async ({ client }) => {
Expand Down Expand Up @@ -562,7 +557,6 @@ describe("Borrow position on blue", () => {
MathLib.WAD + slippageFrom,
);
expect(finalPositionTo.borrowAssets).approximately(
//TODO fix typescript
expectedBorrowAssets,
2n,
);
Expand Down
4 changes: 4 additions & 0 deletions packages/test/src/vitest/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ declare global {
lte(expected: number | bigint | Date): Assertion;
lt(expected: number | bigint | Date): Assertion;
}
interface CloseTo {
// biome-ignore lint/style/useShorthandFunctionType: Chai does it that way
(expected: bigint, delta: bigint, message?: string): Assertion;
}
}
}

0 comments on commit caa8198

Please sign in to comment.