Skip to content

Commit

Permalink
fix: reduce timeout for test
Browse files Browse the repository at this point in the history
  • Loading branch information
barbmarcio committed Aug 5, 2024
1 parent 7ee5ea0 commit 0f7f332
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
15 changes: 3 additions & 12 deletions e2e/auctions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ test.describe("Create Auction via Topsort SDK", () => {
},
],
};
if (typeof window.sdk.createAuction === "undefined") {
throw new Error("Global function `createAuction` is not available.");
}

return window.sdk.createAuction(config, auctionDetails);
});
Expand Down Expand Up @@ -89,9 +86,6 @@ test.describe("Create Auction via Topsort SDK", () => {
},
],
};
if (typeof window.sdk.createAuction === "undefined") {
throw new Error("Global function `createAuction` is not available.");
}

return window.sdk.createAuction(config, auctionDetails);
});
Expand All @@ -111,7 +105,7 @@ test.describe("Create Auction via Topsort SDK", () => {
};

await page.route(`${baseURL}/${apis.auctions}`, async (route) => {
await delay(2000);
await delay(100);
await route.fulfill({ json: mockAPIResponse });
});

Expand All @@ -120,7 +114,7 @@ test.describe("Create Auction via Topsort SDK", () => {
const startTime = Date.now();
const config = {
apiKey: "rando-api-key",
timeOut: 2000,
timeOut: 100,
};

const auctionDetails = {
Expand All @@ -133,16 +127,13 @@ test.describe("Create Auction via Topsort SDK", () => {
},
],
};
if (typeof window.sdk.createAuction === "undefined") {
throw new Error("Global function `createAuction` is not available.");
}

const createAuctionResult = await window.sdk.createAuction(config, auctionDetails);
const endTime = Date.now();
return { createAuctionResult, timeTaken: endTime - startTime };
});

expect(result.createAuctionResult).toEqual(mockAPIResponse);
expect(result.timeTaken).toBeGreaterThanOrEqual(2000);
expect(result.timeTaken).toBeGreaterThanOrEqual(100);
});
});
7 changes: 0 additions & 7 deletions e2e/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ test.describe("Report Events via Topsort SDK", () => {
],
};

if (typeof window.sdk.reportEvent === "undefined") {
throw new Error("Global function `reportEvent` is not available.");
}

return window.sdk.reportEvent(config, event);
});

Expand Down Expand Up @@ -71,9 +67,6 @@ test.describe("Report Events via Topsort SDK", () => {
},
],
};
if (typeof window.sdk.reportEvent === "undefined") {
throw new Error("Global function `reportEvent` is not available.");
}

return window.sdk.reportEvent(config, event);
});
Expand Down

0 comments on commit 0f7f332

Please sign in to comment.