Skip to content

Commit

Permalink
TS lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dsctt committed Nov 23, 2024
1 parent 385e3d5 commit fed04b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"prepare": "husky"
},
"lint-staged": {
"*": ["biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true"]
"*": [
"biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true"
]
},
"keywords": [],
"author": "Solana Foundation",
Expand All @@ -31,5 +33,6 @@
"anchor-bankrun": "^0.4.0",
"chai": "^5.1.1",
"solana-bankrun": "^0.3.0"
}
},
"packageManager": "[email protected]+sha512.6e2baf77d06b9362294152c851c4f278ede37ab1eba3a55fda317a4a17b209f4dbb973fb250a77abc463a341fcb1f17f17cfa24091c4eb319cda0d9b84278387"
}
24 changes: 12 additions & 12 deletions tokens/token-swap/anchor/tests/deposit-liquidity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ describe('Deposit liquidity', () => {


it('Deposit amounts a > b, then a < b', async () => {
var depositAmountA = new BN(9 * 10 ** 6)
var depositAmountB = new BN(4 * 10 ** 6)
const depositAmountA = new BN(9 * 10 ** 6)
const depositAmountB = new BN(4 * 10 ** 6)
await program.methods
.depositLiquidity(depositAmountA, depositAmountB)
.accounts({
Expand Down Expand Up @@ -130,10 +130,10 @@ describe('Deposit liquidity', () => {
// Expected behavior is that depositAmountA gets increased to
// (27 * 10 ** 6) * (9/4) = 60.75 * 10 ** 6
// to maintain the ratio established in the above deposit
depositAmountA = new BN(18 * 10 ** 6)
depositAmountB = new BN(27 * 10 ** 6)
const depositAmountA2 = new BN(18 * 10 ** 6)
const depositAmountB2 = new BN(27 * 10 ** 6)
await program.methods
.depositLiquidity(depositAmountA, depositAmountB)
.depositLiquidity(depositAmountA2, depositAmountB2)
.accounts({
pool: values.poolKey,
poolAuthority: values.poolAuthority,
Expand All @@ -159,12 +159,12 @@ describe('Deposit liquidity', () => {
.sub(new BN(60.75 * 10 ** 6)).toString());
const depositTokenAccountB2 = await connection.getTokenAccountBalance(values.holderAccountB);
expect(depositTokenAccountB2.value.amount).to.equal(new BN (depositTokenAccountB.value.amount)
.sub(depositAmountB).toString());
.sub(depositAmountB2).toString());
});

it('Deposit amounts a < b, then a > b', async () => {
var depositAmountA = new BN(4 * 10 ** 6)
var depositAmountB = new BN(9 * 10 ** 6)
const depositAmountA = new BN(4 * 10 ** 6)
const depositAmountB = new BN(9 * 10 ** 6)
await program.methods
.depositLiquidity(depositAmountA, depositAmountB)
.accounts({
Expand Down Expand Up @@ -194,10 +194,10 @@ describe('Deposit liquidity', () => {
// Expected behavior is that depositAmountB gets increased to
// (27 * 10 ** 6) * (9/4) = 60.75 * 10 ** 6
// to maintain the ratio established in the above deposit
depositAmountA = new BN(27 * 10 ** 6)
depositAmountB = new BN(18 * 10 ** 6)
const depositAmountA2 = new BN(27 * 10 ** 6)
const depositAmountB2 = new BN(18 * 10 ** 6)
await program.methods
.depositLiquidity(depositAmountA, depositAmountB)
.depositLiquidity(depositAmountA2, depositAmountB2)
.accounts({
pool: values.poolKey,
poolAuthority: values.poolAuthority,
Expand All @@ -220,7 +220,7 @@ describe('Deposit liquidity', () => {
.toString());
const depositTokenAccountA2 = await connection.getTokenAccountBalance(values.holderAccountA);
expect(depositTokenAccountA2.value.amount).to.equal(new BN (depositTokenAccountA.value.amount)
.sub(depositAmountA).toString());
.sub(depositAmountA2).toString());
const depositTokenAccountB2 = await connection.getTokenAccountBalance(values.holderAccountB);
expect(depositTokenAccountB2.value.amount).to.equal(new BN (depositTokenAccountB.value.amount)
.sub(new BN(60.75 * 10 ** 6)).toString());
Expand Down

0 comments on commit fed04b1

Please sign in to comment.