Skip to content

Commit

Permalink
Merge pull request #486 from OasisDEX/api-tests-update-trigger-autosell
Browse files Browse the repository at this point in the history
Api tests update trigger autosell
  • Loading branch information
juan-langa authored Sep 5, 2024
2 parents aefcb1e + a5427b1 commit ed4ef75
Show file tree
Hide file tree
Showing 10 changed files with 655 additions and 175 deletions.
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const defaultConfig: PlaywrightTestConfig = {
{
name: 'with-wallet-open-positions-aave-l2s',
testMatch: [
'withWallet/z_openPositions/aaveV3/arbitrum/**',
// 'withWallet/z_openPositions/aaveV3/arbitrum/**', INVESTIGATING while it's failing in gitHub
'withWallet/z_openPositions/aaveV3/base/**',
'withWallet/z_openPositions/aaveV3/optimism/**',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.autoBuyDoesNotExist);
});

test('Add automation - Without "dpm"', async ({ request }) => {
test('Update automation - Without "dpm"', async ({ request }) => {
const { dpm, ...payloadWithoutDpm } = validPayloads;

const response = await request.post(autoBuyEndpoint, {
Expand All @@ -166,7 +166,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongDpm);
});

test('Add automation - Wrong data type - "dpm"', async ({ request }) => {
test('Update automation - Wrong data type - "dpm"', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, dpm: 1 },
});
Expand All @@ -176,7 +176,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongDpm);
});

test('Add automation - Wrong value - "dpm"', async ({ request }) => {
test('Update automation - Wrong value - "dpm"', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, dpm: '0xwrong' },
});
Expand All @@ -186,7 +186,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongDpm);
});

test('Add automation - Without "position"', async ({ request }) => {
test('Update automation - Without "position"', async ({ request }) => {
const { position, ...payloadWithoutPosition } = validPayloads;

const response = await request.post(autoBuyEndpoint, {
Expand All @@ -198,7 +198,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.missingPosition);
});

test('Add automation - Wrong data type - "position" - string', async ({ request }) => {
test('Update automation - Wrong data type - "position" - string', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, position: 'string' },
});
Expand All @@ -208,7 +208,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongPosition_string);
});

test('Add automation - Wrong data type - "position" - number', async ({ request }) => {
test('Update automation - Wrong data type - "position" - number', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, position: 1 },
});
Expand All @@ -218,7 +218,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongPosition_number);
});

test('Add automation - Wrong data type - "position" - array', async ({ request }) => {
test('Update automation - Wrong data type - "position" - array', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, position: [] },
});
Expand All @@ -228,7 +228,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongPosition_array);
});

test('Add automation - Wrong data type - "position" - null', async ({ request }) => {
test('Update automation - Wrong data type - "position" - null', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, position: null },
});
Expand All @@ -238,7 +238,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongPosition_null);
});

test('Add automation - Without "collateral (position)"', async ({ request }) => {
test('Update automation - Without "collateral (position)"', async ({ request }) => {
const { position, ...payloadWithoutPosition } = validPayloads;
const { collateral, ...positionWithoutCollateral } = position;

Expand All @@ -251,7 +251,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongCollateral);
});

test('Add automation - Wrong data type - "collateral (position)"', async ({ request }) => {
test('Update automation - Wrong data type - "collateral (position)"', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: {
...validPayloads,
Expand All @@ -267,7 +267,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongCollateral);
});

test('Add automation - Wrong value - "collateral (position)"', async ({ request }) => {
test('Update automation - Wrong value - "collateral (position)"', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: {
...validPayloads,
Expand All @@ -283,7 +283,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongCollateral);
});

test('Add automation - Without "debt (position)"', async ({ request }) => {
test('Update automation - Without "debt (position)"', async ({ request }) => {
const { position, ...payloadWithoutPosition } = validPayloads;
const { debt, ...positionWithoutDebt } = position;

Expand All @@ -296,7 +296,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongDebt);
});

test('Add automation - Wrong data type - "debt (position)"', async ({ request }) => {
test('Update automation - Wrong data type - "debt (position)"', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: {
...validPayloads,
Expand All @@ -312,7 +312,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongDebt);
});

test('Add automation - Wrong value - "debt (position)"', async ({ request }) => {
test('Update automation - Wrong value - "debt (position)"', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: {
...validPayloads,
Expand All @@ -328,7 +328,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongDebt);
});

test('Add automation - Without "triggerData"', async ({ request }) => {
test('Update automation - Without "triggerData"', async ({ request }) => {
const { triggerData, ...payloadWithoutTriggerData } = validPayloads;

const response = await request.post(autoBuyEndpoint, {
Expand All @@ -340,7 +340,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.missingTriggerData);
});

test('Add automation - Wrong data type - "triggerData" - string', async ({ request }) => {
test('Update automation - Wrong data type - "triggerData" - string', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, triggerData: 'string' },
});
Expand All @@ -350,7 +350,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongTriggerData_string);
});

test('Add automation - Wrong data type - "triggerData" - number', async ({ request }) => {
test('Update automation - Wrong data type - "triggerData" - number', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, triggerData: 1 },
});
Expand All @@ -360,7 +360,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongTriggerData_number);
});

test('Add automation - Wrong data type - "triggerData" - array', async ({ request }) => {
test('Update automation - Wrong data type - "triggerData" - array', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, triggerData: [] },
});
Expand All @@ -370,7 +370,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongTriggerData_array);
});

test('Add automation - Wrong data type - "triggerData" - null', async ({ request }) => {
test('Update automation - Wrong data type - "triggerData" - null', async ({ request }) => {
const response = await request.post(autoBuyEndpoint, {
data: { ...validPayloads, triggerData: null },
});
Expand All @@ -380,7 +380,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongTriggerData_null);
});

test('Add automation - Without "executionLTV (triggerData)"', async ({ request }) => {
test('Update automation - Without "executionLTV (triggerData)"', async ({ request }) => {
const { triggerData, ...payloadWithoutTriggerData } = validPayloads;
const { executionLTV, ...triggerDataWithoutExecutionLTV } = triggerData;

Expand All @@ -393,7 +393,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongExecutionLTV);
});

test('Add automation - Without "maxBaseFee (triggerData)"', async ({ request }) => {
test('Update automation - Without "maxBaseFee (triggerData)"', async ({ request }) => {
const { triggerData, ...payloadWithoutTriggerData } = validPayloads;
const { maxBaseFee, ...triggerDataWithoutMaxBaseFee } = triggerData;

Expand All @@ -406,7 +406,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongMaxBaseFee);
});

test('Add automation - Without "targetLTV (triggerData)"', async ({ request }) => {
test('Update automation - Without "targetLTV (triggerData)"', async ({ request }) => {
const { triggerData, ...payloadWithoutTriggerData } = validPayloads;
const { targetLTV, ...triggerDataWithoutTargetLTV } = triggerData;

Expand All @@ -419,7 +419,7 @@ test.describe('API tests - Auto-Buy - Update - Aave V3 - Arbitrum', async () =>
expect(respJSON).toMatchObject(responses.wrongTargetLTV);
});

test('Add automation - Without "useMaxBuyPrice (triggerData)"', async ({ request }) => {
test('Update automation - Without "useMaxBuyPrice (triggerData)"', async ({ request }) => {
const { triggerData, ...payloadWithoutTriggerData } = validPayloads;
const { maxBuyPrice, useMaxBuyPrice, ...triggerDataWithoutUseMaxBuyPrice } = triggerData;

Expand Down
Loading

0 comments on commit ed4ef75

Please sign in to comment.