-
Notifications
You must be signed in to change notification settings - Fork 448
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
test(sanity): add toMatchEmissions
matcher
#8519
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
No changes to documentation |
Component Testing Report Updated Feb 6, 2025 1:35 PM (UTC) ❌ Failed Tests (1) -- expand for details
|
⚡️ Editor Performance ReportUpdated Thu, 06 Feb 2025 13:36:52 GMT
Detailed information🏠 Reference resultThe performance result of
🧪 Experiment resultThe performance result of this branch
📚 Glossary
|
d34af75
to
7c02363
Compare
Coverage Report
File CoverageNo changed files found. |
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.
Great idea
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.
Q: Should we add some tests for this test... inception, but perhaps just the ones you included in the description of the PR could we added alongside this. Just given that this isn't being used anywhere yet, that feels like it would be quite good. What do you think?
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.
I wondered that, too. I agree it's probably a good idea!
export async function toMatchEmissions( | ||
this: MatcherState, | ||
createOperator: () => OperatorFunction<unknown, unknown>, | ||
snapshots: [A: unknown, B: unknown][], |
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.
COULD: could rename these types to:
snapshots: [A: unknown, B: unknown][], | |
snapshots: [value: unknown, emission: unknown][], |
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.
Good point. I actually did use those names initially, but changed them to become consistent with RxJS' types where you see things like UnaryFunction<A, B>
.
7c02363
to
c135ab5
Compare
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.
Nice one!
Description
This branch adds a
toMatchEmissions
matcher to Vitest. This can be used to assert a specific value is emitted for each value that is piped to a given observable.You can see how this is used in practice by taking a look at the next commit in this Graphite stack.
What to review
Testing