Repository navigation
Commit 083a0df
committed
Extract shared behavioural test utilities into @aehrc/questionnaire-test-toolkit
The Aboriginal and Torres Strait Islander Health Check suite's helpers lived in
apps/smart-forms-app/src/test/. A form's test suite that lives outside this
application cannot reach them there.
Move testUtils.ts and behavioralTestUtils.tsx into a package and repoint the
suite at it. The package is built with tsup (dual ESM/CJS + declarations), the
same line the other four published packages here use, so that entry points
reference dist rather than raw TypeScript and an external consumer needs no
transform configuration of its own.
Notable choices, all made to avoid repeating the @aehrc/testing-toolkit failure
in aehrc#1586, where the package was published in name only:
- files is ["dist"], not ["src"], so the tarball has a runtime entry point.
- vitest is not a dependency at any level. invokeExtract took a Mock<...> and
only ever read .mock.lastCall, so it now takes a structural ExtractResultSpy
that an untyped vi.fn() or jest.fn() satisfies. No consumer is forced onto a
particular test runner.
- @types/fhir is a dependency and @types/react a peer, because both appear in
the emitted declarations - fhir/r4 for Patient and Questionnaire,
react/jsx-runtime for the wrapper's return type.
- React, the renderer, TanStack Query and both testing libraries stay external,
so no consumer can end up with a second React or a second renderer store.
Verified by packing the tarball and installing it into a project outside this
workspace, type-checking with skipLibCheck: false, then mounting the harness
and running an interaction and an extraction test there. Inside the monorepo
the packages/* glob resolves the toolkit locally no matter what is published,
which is exactly what made aehrc#1586 look green.1 parent 55653cb commit 083a0df
24 files changed
Lines changed: 624 additions & 86 deletions
File tree
- apps/smart-forms-app
- src/test
- packages/questionnaire-test-toolkit
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
0 commit comments