Commit ddd7ab0
committed
fix(plugins): keep the plugin query tests off the plugin registry
The read-only query API added in #1784 is exercised through
`createAppAPI`, which lives in `usePlugins.ts`. That module imports the
whole built-in plugin registry, so loading it in a Node test pulled in
MapCanvas, CesiumCanvas, and every `maplibre-*` plugin: 39 browser-only
modules, none of them meaningfully exercised, all of them newly counted
by the coverage reporter.
Coverage is reported only over files a test actually imports, so those 39
files landed in the denominator at 1-30% function coverage and dropped
the total from 72.90% to 60.36%, under the 63% floor. CI has been red on
`main` since, and the report is measuring module reachability rather than
how well the code is tested.
Move the six query methods and `readPluginSelection` into
`lib/plugin-layer-queries.ts`, which needs only the store, and have
`createAppAPI` spread them in. The test imports that module directly and
no longer stubs `maplibre-gl`, `window`, `sessionStorage`, or
`localStorage` to get off the ground. Same reasoning, and the same shape,
as `geo-editor-geometry.ts` in `@geolibre/plugins`, which is already kept
free of the Geoman/MapLibre runtime so it can be unit-tested under Node.
`SKETCHES_SOURCE_KIND` gets a subpath export alongside the five already
in that package, so the test can share the constant instead of repeating
the string literal as it did before.
The wiring into the plugin-facing API is now a typed spread rather than
something this test asserts; `tsc` covers it on every build.
Coverage returns to 82.84% lines / 84.45% branches / 72.55% functions
(baseline before #1784: 82.89 / 84.46 / 72.90), with the counted file set
back from 444 to 406. The one addition is the extracted module itself, at
100% lines and 95.45% functions. All 8 tests still pass.1 parent 6093aa8 commit ddd7ab0
4 files changed
Lines changed: 118 additions & 130 deletions
File tree
- apps/geolibre-desktop/src
- hooks
- lib
- packages/plugins
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
97 | | - | |
98 | 96 | | |
99 | 97 | | |
100 | 98 | | |
| |||
132 | 130 | | |
133 | 131 | | |
134 | 132 | | |
| 133 | + | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
831 | 830 | | |
832 | 831 | | |
833 | 832 | | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | 833 | | |
850 | 834 | | |
851 | 835 | | |
| |||
857 | 841 | | |
858 | 842 | | |
859 | 843 | | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
881 | | - | |
882 | | - | |
883 | | - | |
884 | | - | |
885 | | - | |
886 | | - | |
887 | | - | |
888 | | - | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
893 | | - | |
| 844 | + | |
894 | 845 | | |
895 | 846 | | |
896 | 847 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
| 6 | + | |
5 | 7 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
59 | 15 | | |
60 | 16 | | |
61 | 17 | | |
| |||
74 | 30 | | |
75 | 31 | | |
76 | 32 | | |
77 | | - | |
78 | | - | |
| 33 | + | |
| 34 | + | |
79 | 35 | | |
80 | | - | |
| 36 | + | |
81 | 37 | | |
82 | 38 | | |
83 | 39 | | |
84 | 40 | | |
85 | 41 | | |
86 | | - | |
| 42 | + | |
87 | 43 | | |
88 | | - | |
| 44 | + | |
89 | 45 | | |
90 | 46 | | |
91 | 47 | | |
| |||
109 | 65 | | |
110 | 66 | | |
111 | 67 | | |
112 | | - | |
113 | | - | |
| 68 | + | |
| 69 | + | |
114 | 70 | | |
115 | 71 | | |
116 | 72 | | |
| |||
119 | 75 | | |
120 | 76 | | |
121 | 77 | | |
122 | | - | |
| 78 | + | |
123 | 79 | | |
124 | 80 | | |
125 | 81 | | |
126 | 82 | | |
127 | 83 | | |
128 | 84 | | |
129 | 85 | | |
130 | | - | |
131 | | - | |
132 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
133 | 89 | | |
134 | 90 | | |
135 | 91 | | |
| |||
152 | 108 | | |
153 | 109 | | |
154 | 110 | | |
155 | | - | |
| 111 | + | |
156 | 112 | | |
157 | | - | |
| 113 | + | |
158 | 114 | | |
159 | 115 | | |
160 | 116 | | |
161 | 117 | | |
162 | 118 | | |
163 | 119 | | |
164 | 120 | | |
165 | | - | |
166 | | - | |
167 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
168 | 124 | | |
169 | 125 | | |
170 | 126 | | |
| |||
184 | 140 | | |
185 | 141 | | |
186 | 142 | | |
187 | | - | |
188 | | - | |
| 143 | + | |
| 144 | + | |
189 | 145 | | |
190 | 146 | | |
191 | 147 | | |
| |||
203 | 159 | | |
204 | 160 | | |
205 | 161 | | |
206 | | - | |
207 | | - | |
| 162 | + | |
| 163 | + | |
208 | 164 | | |
209 | 165 | | |
210 | 166 | | |
| |||
218 | 174 | | |
219 | 175 | | |
220 | 176 | | |
221 | | - | |
222 | | - | |
223 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
224 | 180 | | |
225 | 181 | | |
226 | 182 | | |
| |||
244 | 200 | | |
245 | 201 | | |
246 | 202 | | |
247 | | - | |
| 203 | + | |
248 | 204 | | |
249 | 205 | | |
250 | 206 | | |
| |||
0 commit comments