You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Description
Add some examples showing patterns for open polymorphism with tree
schema.
These examples are derived from those in
microsoft#23084, showing cases
which motivate that work, but do not (yet) include the examples from
that PR showing how it helps. Merging this PR first will help that one
better show its value.
Copy file name to clipboardExpand all lines: packages/dds/tree/src/test/README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,9 +22,22 @@ Assuming all code has such tests, and only relies of documented behavior of the
22
22
In practice, testing of this type will not cover all cases: this is expected.
23
23
When a testing gap is found and determined worth covering (for example due to a bug, new code, or audit of coverage), it should always be possible to address it by adding more tests following this pattern (for example regression tests can always be implemented as a `spec` test for the code which contained the bug).
24
24
Note that the fact that this approach is always possible does not make it the best approach: using spec tests in this way should be the first option considered, but if a better testing approach is found, it can be used instead as long as it is documented appropriately.
25
+
-`integration`: Tests for using multiple APIs together.
26
+
If there is a corresponding `spec` file which is sufficiently large in scope, the tests should be placed within it:
27
+
only when the tests don't cleanly correspond to a particular source file should a separate `integration` file be created.
28
+
When created, the file should be placed in the `src/test` directory's sub folder which is the most nested it can be while still including all the relevant APIs.
29
+
For example tests and examples of using `src/thing/foo` with `src/thing/bar` would belong in `src/test/thing` and could be named something like `fooWithBar.integration.ts`.
30
+
If it is not entirely clear exactly what tests belong in a given `integration` file based on just the file name, a doc comment should be included at the top explaining the scope.
25
31
26
32
Any other kinds of test files should be documented when created by adding them to this list.
27
33
34
+
## Examples
35
+
36
+
Code showing how to use an API can be included in tests.
37
+
Such tests should mention that they are an "example" somewhere in the file name, suite or test name.
38
+
These are not intended to serve as tests for the APIs, but are written as tests to ensure the examples stay up to date.
39
+
If there is a corresponding `spec` file, the examples should be included within it: only when the examples don't cleanly correspond to a particular source file should a separate `examples` file be created. When created, the file should be places in the `src/test` directory's sub folder which corresponds to the most nested it can be while still including all the relevant APIs. For example an example of using `src/thing/foo` with `src/thing/bar` would belong in `src/test/thing` and could be named something like `fooWithBar.example.ts`.
40
+
28
41
## Test Tagging
29
42
30
43
Tests can be [tagged](https://mochajs.org/next/explainers/tagging/).
0 commit comments