Skip to content

Commit

Permalink
add global test timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhaiwat10 committed Dec 27, 2024
1 parent d5a5697 commit b12e5f6
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 92 deletions.
6 changes: 0 additions & 6 deletions test/add_liquidity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ beforeEach(() => {

test(
'add liquidity',
{
timeout: 30000,
},
async () => {
console.log(
await agent.addLiquidity({
Expand All @@ -25,9 +22,6 @@ test(

test(
'add liquidity via natural language',
{
timeout: 60000,
},
async () => {
console.log(
await agent.execute(
Expand Down
32 changes: 10 additions & 22 deletions test/balance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,14 @@ beforeEach(() => {
agent = createTestAgent();
});

test(
'get own balance',
async () => {
const balance = await agent.execute('Get my USDC balance');
console.log(balance);
},
{
timeout: 500000,
},
);
test('get own balance', async () => {
const balance = await agent.execute('Get my USDC balance');
console.log(balance);
});

test(
'get balance of a wallet',
async () => {
const balance = await agent.execute(
'Get the ETH balance of 0x8F8afB12402C9a4bD9678Bec363E51360142f8443FB171655eEd55dB298828D1',
);
console.log(balance);
},
{
timeout: 500000,
},
);
test('get balance of a wallet', async () => {
const balance = await agent.execute(
'Get the ETH balance of 0x8F8afB12402C9a4bD9678Bec363E51360142f8443FB171655eEd55dB298828D1',
);
console.log(balance);
});
12 changes: 3 additions & 9 deletions test/borrow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ beforeEach(() => {
agent = createTestAgent();
});

test(
'borrowAsset',
async () => {
console.log(await agent.execute('Borrow 11 USDC'));
},
{
timeout: 500000,
},
);
test('borrowAsset', async () => {
console.log(await agent.execute('Borrow 11 USDC'));
});
12 changes: 3 additions & 9 deletions test/deposit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ beforeEach(() => {
agent = createTestAgent();
});

test(
'supplyCollateral',
async () => {
console.log(await agent.execute('Supply 2 USDT as collateral'));
},
{
timeout: 500000,
},
);
test('supplyCollateral', async () => {
console.log(await agent.execute('Supply 2 USDT as collateral'));
});
12 changes: 3 additions & 9 deletions test/execute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ beforeEach(() => {
agent = createTestAgent();
});

test(
'execute swap',
async () => {
console.log(await agent.execute('swap 5 usdc for eth'));
},
{
timeout: 60000,
},
);
test('execute swap', async () => {
console.log(await agent.execute('swap 5 usdc for eth'));
});
36 changes: 12 additions & 24 deletions test/swap.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,16 @@ beforeEach(() => {
agent = createTestAgent();
});

test(
'swap exact input',
{
timeout: 30000,
},
async () => {
console.log(
await agent.swapExactInput({
amount: '1',
fromSymbol: 'USDC',
toSymbol: 'ETH',
}),
);
},
);
test('swap exact input', async () => {
console.log(
await agent.swapExactInput({
amount: '1',
fromSymbol: 'USDC',
toSymbol: 'ETH',
}),
);
});

test(
'swap via natural language',
{
timeout: 60000,
},
async () => {
console.log(await agent.execute('Swap 0.1 USDC to ETH with 5% slippage'));
},
);
test('swap via natural language', async () => {
console.log(await agent.execute('Swap 0.1 USDC to ETH with 5% slippage'));
});
20 changes: 7 additions & 13 deletions test/transfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@ beforeEach(() => {
agent = createTestAgent();
});

test(
'transfer USDC to another wallet',
async () => {
console.log(
await agent.execute(
'Transfer 2 USDC to 0x8F8afB12402C9a4bD9678Bec363E51360142f8443FB171655eEd55dB298828D1',
),
);
},
{
timeout: 60000,
},
);
test('transfer USDC to another wallet', async () => {
console.log(
await agent.execute(
'Transfer 2 USDC to 0x8F8afB12402C9a4bD9678Bec363E51360142f8443FB171655eEd55dB298828D1',
),
);
});
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export default defineConfig(({ mode }) => ({
test: {
// mode defines what ".env.{mode}" file to choose if exists
env: loadEnv(mode, process.cwd(), ''),
testTimeout: 120000,
},
}));

0 comments on commit b12e5f6

Please sign in to comment.