-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(sdk): further setup for integration tests #3282
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
general comments:
- noticed you're not using/extending the shared test setup stuff - was that intentional? or are you planning to refactor?
- could be nice to pull out some of the input data to clean up the tests a bit
- do you mind following the test name pattern as in units? or if you have a suggestion to alter it's welcomed! but would be good to add some structure
} from './test-utils.js' | ||
|
||
test('successfully processes order from quote to filled', async () => { | ||
const wagmiConfig = createWagmiConfig() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see createWrapper
in react.ts
we can lift this out / reduce duplication
@@ -0,0 +1,95 @@ | |||
import { act, render, waitFor } from '@testing-library/react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you planning to create more specific test modules? would be good to decouple a bit
aka test quote and order in isolation, and together
}) | ||
await waitFor(() => expect(quoteHook.result.current.isSuccess).toBe(true)) | ||
|
||
const quote = quoteHook.result.current.query.data as Quote |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious, why do you need this type cast?
const quote = quoteHook.result.current.query.data as Quote | ||
expect(quote).toEqual({ | ||
deposit: { token: ZERO_ADDRESS, amount: 2n * ETHER }, | ||
expense: { token: ZERO_ADDRESS, amount: 1994017946161515453n }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the expense values are driven by the response from the solver api, so this assertion is unstable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could instead assert the value exists, and is less than or equal to the deposit amount maybe?
Only goes through a single check for now, will add more in future PRs
issue: none