-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add USDC and USDC.e support to the vortex pmf (#72)
* Replace `jest` with `vitest` for testing * Create test for getting route from squidrouter * Use vitest dependencies * Remove all references to jest * Add usdce and allow to pass fromToken to getRoute * Add refactoring * Amend merge * Fix squidrouter tests * Configure icon for usdce * Configure happy-dom to make browser based tests work * Remove NumericInput.test.tsx because it doesn't work with vitest * Fix type error
- Loading branch information
Showing
17 changed files
with
929 additions
and
2,290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { beforeEach, describe, expect, it } from 'vitest'; | ||
import { getRouteTransactionRequest } from '../route'; | ||
import { INPUT_TOKEN_CONFIG, InputTokenDetails } from '../../../constants/tokenConfig'; | ||
|
||
// We need to add a delay to the beforeEach hook to ensure that the test does not run before the SquidRouter API is ready | ||
beforeEach(() => { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve(); | ||
}, 2000); | ||
}); | ||
}); | ||
|
||
describe('Squidrouter', () => { | ||
describe('should be able to get route for relevant USDC tokens', () => { | ||
function getRouteForToken(inputToken: InputTokenDetails) { | ||
// These addresses don't really matter | ||
const userAddress = '0x7Ba99e99Bc669B3508AFf9CC0A898E869459F877'; | ||
const ephemeralAddress = '0x7Ba99e99Bc669B3508AFf9CC0A898E869459F877'; | ||
const amount = '1000000000'; | ||
|
||
return getRouteTransactionRequest(userAddress, amount, ephemeralAddress, inputToken); | ||
} | ||
|
||
it('should successfully query a route for USDC', async () => { | ||
const inputToken = INPUT_TOKEN_CONFIG.usdc; | ||
const route = await getRouteForToken(inputToken); | ||
|
||
expect(route).toBeDefined(); | ||
expect(route.requestId).toBeDefined(); | ||
expect(route.data).toBeDefined(); | ||
}); | ||
|
||
it('should successfully query a route for USDC.e', async () => { | ||
const inputToken = INPUT_TOKEN_CONFIG.usdce; | ||
const route = await getRouteForToken(inputToken); | ||
|
||
expect(route).toBeDefined(); | ||
expect(route.requestId).toBeDefined(); | ||
expect(route.data).toBeDefined(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@testing-library/jest-dom/vitest'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.