Skip to content

Commit

Permalink
fix: timeout for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ho3einWave committed Oct 1, 2024
1 parent 348dd9e commit 3e6bf48
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
node-version: 18
- run: bun install
- run: bun test
- run: npm run build
- run: npm publish
- run: bun run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
60 changes: 40 additions & 20 deletions src/services/swap/swap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,44 @@ beforeEach(() => {
client = new MyTonSwapClient();
});

test('it should get data for swap from stonfi', async () => {
await sleep(1500);
const TON = await client.assets.getExactAsset('TON');
const NOT = await client.assets.getExactAsset('NOT');
const bestRoute = await client.router.findBestRoute(TON!.address, NOT!.address, 1, 1, 'stonfi');
const swap = await client.swap.swap(userWallet, bestRoute);
expect(swap).toBeObject();
expect(swap?.value).not.toBeUndefined();
expect(swap?.value).toBeGreaterThan(toNano(1));
});
test(
'it should get data for swap from stonfi',
async () => {
await sleep(1500);
const TON = await client.assets.getExactAsset('TON');
const NOT = await client.assets.getExactAsset('NOT');
const bestRoute = await client.router.findBestRoute(
TON!.address,
NOT!.address,
1,
1,
'stonfi',
);
const swap = await client.swap.swap(userWallet, bestRoute);
expect(swap).toBeObject();
expect(swap?.value).not.toBeUndefined();
expect(swap?.value).toBeGreaterThan(toNano(1));
},
{ timeout: 10000 },
);

test('it should get data for swap from dedust', async () => {
await sleep(1500);
const TON = await client.assets.getExactAsset('TON');
const NOT = await client.assets.getExactAsset('NOT');
const bestRoute = await client.router.findBestRoute(TON!.address, NOT!.address, 1, 1, 'dedust');
const swap = await client.swap.swap(userWallet, bestRoute);
expect(swap).toBeObject();
expect(swap?.value).not.toBeUndefined();
expect(swap?.value).toBeGreaterThan(toNano(1));
});
test(
'it should get data for swap from dedust',
async () => {
await sleep(1500);
const TON = await client.assets.getExactAsset('TON');
const NOT = await client.assets.getExactAsset('NOT');
const bestRoute = await client.router.findBestRoute(
TON!.address,
NOT!.address,
1,
1,
'dedust',
);
const swap = await client.swap.swap(userWallet, bestRoute);
expect(swap).toBeObject();
expect(swap?.value).not.toBeUndefined();
expect(swap?.value).toBeGreaterThan(toNano(1));
},
{ timeout: 10000 },
);

0 comments on commit 3e6bf48

Please sign in to comment.