Skip to content

Commit 3074e7c

Browse files
committed
Fix flaky ETH price test (#6682)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on updating tests in the `cryptoToFiat` and `Status` files, improving assertions and changing transaction details to reflect new data. ### Detailed summary - In `cryptoToFiat.test.ts`: - Changed assertion from checking if `data.result` is greater than 1500 to ensuring it's greater than 0. - In `Status.test.ts`: - Updated `transactionHash` and related transaction details, including: - Modified `destinationAmount`, `destinationChainId`, and `destinationTokenAddress`. - Adjusted `originAmount` and `originTokenAddress`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent dd99410 commit 3074e7c

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

packages/thirdweb/src/bridge/Status.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("Bridge.status", () => {
77
it("should handle successful status", async () => {
88
const result = await status({
99
transactionHash:
10-
"0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
10+
"0x7bedc4693e899fe81a22dac11301e77a12a6e772834bba5b698baf3ebcf86f7a",
1111
chainId: 8453,
1212
client: TEST_CLIENT,
1313
});
@@ -16,21 +16,21 @@ describe.runIf(process.env.TW_SECRET_KEY)("Bridge.status", () => {
1616
expect(result.status).toBe("COMPLETED");
1717
expect(result).toMatchInlineSnapshot(`
1818
{
19-
"destinationAmount": 188625148000000n,
20-
"destinationChainId": 2741,
21-
"destinationTokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
22-
"originAmount": 200000000000000n,
19+
"destinationAmount": 500000n,
20+
"destinationChainId": 466,
21+
"destinationTokenAddress": "0x675C3ce7F43b00045a4Dab954AF36160fb57cB45",
22+
"originAmount": 524750n,
2323
"originChainId": 8453,
24-
"originTokenAddress": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
24+
"originTokenAddress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
2525
"status": "COMPLETED",
2626
"transactions": [
2727
{
2828
"chainId": 8453,
29-
"transactionHash": "0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
29+
"transactionHash": "0x7bedc4693e899fe81a22dac11301e77a12a6e772834bba5b698baf3ebcf86f7a",
3030
},
3131
{
32-
"chainId": 2741,
33-
"transactionHash": "0xa70a82f42330f54be95a542e1fcfe6ed2dd9f07fb8c82ae67afb4342319f7433",
32+
"chainId": 466,
33+
"transactionHash": "0xb0de713fbe44b7939b3c9cfa02c0233ea659d1163cc4462462e12eef57bc17f1",
3434
},
3535
],
3636
}
@@ -40,7 +40,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("Bridge.status", () => {
4040
it("should handle successfull status with chain", async () => {
4141
const result = await status({
4242
transactionHash:
43-
"0xe199ef82a0b6215221536e18ec512813c1aa10b4f5ed0d4dfdfcd703578da56d",
43+
"0x7bedc4693e899fe81a22dac11301e77a12a6e772834bba5b698baf3ebcf86f7a",
4444
chain: defineChain(8453),
4545
client: TEST_CLIENT,
4646
});

packages/thirdweb/src/pay/convert/cryptoToFiat.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("Pay: crypto-to-fiat", () => {
3535
expect(data.result).toBeDefined();
3636
// Should be a number
3737
expect(!Number.isNaN(data.result)).toBe(true);
38-
// Since eth is around US$3000, we can add a test to check if the price is greater than $1500 (as a safe margin)
39-
// let's hope that scenario does not happen :(
40-
expect(data.result > 1500).toBe(true);
38+
expect(data.result).toBeGreaterThan(0);
4139
});
4240

4341
it("should return zero if fromAmount is zero", async () => {

0 commit comments

Comments
 (0)