Commit a1ac29d
authored
Explicitly test reporting errors in fluent-react (#520)
* Run prettier on test files to minimize inline snapshot code diff
Inline snapshots in Jest are powered by Prettier, however prettier
does not appear to be hooked up to the eslint.
https://jestjs.io/docs/en/snapshot-testing#inline-snapshots
In the following commits I add new inline snapshot tests, which
invalidates a lot of the existing formatting. This commit runs prettier
on the entire test directory to ensure that the following commits have
clean code diffs.
* Spy on console.warn in tests, and throw an error if called
The current tests aren't explicit on testing the behavior of what
errors get reported. This makes it difficult to understand the
current behavior. This commit adds a mechanism to fail a test if
the console.warn is called unexpectedly. Following commits will fix
up tests that fail from this new mechanism.
* Add explicit checks for what happens with console.warn in tests
These tests use the toMatchInlineSnapshot method to assert that an error
message was called. The snapshot allows for easy updating if the error
messages are re-phrased in the future.1 parent 72f5970 commit a1ac29d
File tree
11 files changed
+576
-375
lines changed- fluent-react
- test
11 files changed
+576
-375
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
17 | | - | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | | - | |
20 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
21 | 28 | | |
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
28 | | - | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | | - | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
32 | 41 | | |
33 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | | - | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | | - | |
| 15 | + | |
| 16 | + | |
12 | 17 | | |
13 | 18 | | |
14 | 19 | | |
| |||
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
32 | | - | |
| 37 | + | |
| 38 | + | |
33 | 39 | | |
34 | | - | |
35 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | | - | |
| 45 | + | |
| 46 | + | |
38 | 47 | | |
39 | 48 | | |
40 | 49 | | |
| |||
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
56 | | - | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | | - | |
| 68 | + | |
| 69 | + | |
59 | 70 | | |
60 | 71 | | |
61 | 72 | | |
| |||
0 commit comments