Skip to content

Commit

Permalink
add test case: absence of LBP raising tokens info
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioyuhjtman committed Mar 2, 2022
1 parent 941428e commit 90039c8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
34 changes: 34 additions & 0 deletions test/boostedPaths.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ describe('multiple boosted pools, path creation test', () => {
context('bbausd and Weth to Dai', () => {
it('four combinations', () => {
const binaryOption = [true, false];
if (!sorConfigTestBoosted.bbausd) return;
for (const reverse of binaryOption) {
const tokens = [
[WETH.address, sorConfigTestBoosted.bbausd.address],
Expand Down Expand Up @@ -373,6 +374,39 @@ describe('multiple boosted pools, path creation test', () => {
assert.equal(boostedPaths.length, 2);
assert.equal(paths.length, 2);
});
it('Test correctness in absence of LBP raising info at config', () => {
const sorConfigNoLbpRaising = cloneDeep(sorConfigTestBoosted);
delete sorConfigNoLbpRaising['lbpRaisingTokens'];
const sorConfigNoRaisingTusd = cloneDeep(sorConfigNoLbpRaising);
sorConfigNoRaisingTusd['lbpRaisingTokens'] = [
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
];
const tokenIn = TUSD.address;
const tokenOut = BAL.address;
const pathsCases: NewPath[][] = [];
const sorConfigCases: SorConfig[] = [
sorConfigTestBoosted,
sorConfigNoLbpRaising,
sorConfigNoRaisingTusd,
];
for (let i = 0; i < 3; i++) {
const [paths] = getPaths(
tokenIn,
tokenOut,
SwapTypes.SwapExactIn,
boostedPools.pools,
maxPools,
sorConfigCases[i]
);
pathsCases.push(paths);
}
assert.equal(pathsCases[0].length, pathsCases[1].length);
assert.equal(pathsCases[0].length, pathsCases[2].length);
for (let i = 0; i < pathsCases[0].length; i++) {
assert.equal(pathsCases[0][i].id, pathsCases[1][i].id);
assert.equal(pathsCases[0][i].id, pathsCases[2][i].id);
}
});
});
});

Expand Down
2 changes: 1 addition & 1 deletion test/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const sorConfigTestStaBal = {
},
};

export const sorConfigTestBoosted = {
export const sorConfigTestBoosted: SorConfig = {
chainId: 99,
weth: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
vault: '0xeefba1e63905ef1d7acba5a8513c70307c1ce441',
Expand Down

0 comments on commit 90039c8

Please sign in to comment.