-
-
Notifications
You must be signed in to change notification settings - Fork 34
Setup testing #760
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
Setup testing #760
Conversation
…ture. - Harnesses are in `packages/layerchart/src/lib/components/tests/ChartHarness.test.svelte` - otherwise colocated tests in ..../components - Original Component does not require any updates. - `test-lc-chart` and `test-lc-component` are added via harness. - Optionally add accessory `data-testid="????"` in Component. I did this for `data-testid="arc-track` so that I could hook onto this accessory. - There are a few tests I didn't know how to write (marked and commented out).
|
commit: |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
|
|
||
| {#if track} | ||
| <Path | ||
| data-testid="arc-track" |
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 data-testid be passed via <Arc track={{ data-testid: "arc-track">` when setting up the tests instead?
| }); | ||
| const mergedComponentProps = $derived({ | ||
| fill: 'blue', |
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.
fill: 'blue' and not needed, and we could just pass
<TestComponent {...componentProps} data-testid="test-lc-component" />
| <canvas | ||
| bind:this={ref} | ||
| style:z-index={zIndex} | ||
| data-testid="canvas-layer" |
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.
do we need this, or handled by ChartHarness?
- removed hardocded `fill-blue`
- remove data-testid from Canvas.svelte
- when needed apply
```ts
componentProps: {
track: { 'data-testid': testId },
}
```
instead of hardcoded in original Component.
- TestHarness (Previously ChartHarness) now support snippet testing - TestHarness supports Testing components w/o Chart (ie SimpleCharts)
…odule import, add packages to fix type errors
…e:" for "Arc.svelte.test.ts"
…cally imported module"
|
Thanks for getting this started @cycle4passion! I fixed the CI-only failure I'm going merge this PR and continue to iterate on testing patterns more on subsequent PRs, especially on the downstream Thanks again! |
First pass testing for Arc. I'm happy for any overhaul for bigger picture.
packages/layerchart/src/lib/components/tests/ChartHarness.test.svelte.../componentstest-lc-chart and test-lc-component are added via harness.
data-testid="arc-track"so that I could hook onto this accessory element.