Commit 05ecb1f
committed
fix(hocuspocus): unblock typecheck on link-metadata tests + html scrape
Four CI typecheck errors after the link-metadata module landed:
- htmlScrape.ts: Bun's TextDecoder ctor types the encoding as a closed
union, but the value is parsed from arbitrary HTTP / HTML headers
and cannot be narrowed statically. Cast to never (matches the
receiver's "trust nothing" stance) — invalid encodings throw and
the existing catch falls back to utf-8.
- http.test.ts: Response.json() returns unknown under bun:test. Added
a local WireBody type + readBody helper so every assertion reads
through a typed boundary instead of `as any`. Kept WireBody
independent of the production discriminated union — intersecting
MetadataResponse & ErrorResponse collapses to never on success.
- htmlScrape.test.ts: dropped the as HeadersInit cast (the type is
not in the bun-types lib set, and Headers ctor accepts
RequestInit['headers'] directly).
- oembed.test.ts: typed the mockImplementation params as
(_url: unknown, init?: RequestInit) so the spy honors the fetch
signature instead of falling back to implicit any.
Made-with: Cursor1 parent 1663ba9 commit 05ecb1f
4 files changed
Lines changed: 35 additions & 14 deletions
File tree
- packages/hocuspocus.server/src/modules/link-metadata
- __tests__
- integration
- unit
- domain/stages
Lines changed: 26 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
7 | 24 | | |
8 | 25 | | |
9 | 26 | | |
| |||
40 | 57 | | |
41 | 58 | | |
42 | 59 | | |
43 | | - | |
| 60 | + | |
44 | 61 | | |
45 | 62 | | |
46 | 63 | | |
| |||
50 | 67 | | |
51 | 68 | | |
52 | 69 | | |
53 | | - | |
| 70 | + | |
54 | 71 | | |
55 | 72 | | |
56 | 73 | | |
| |||
73 | 90 | | |
74 | 91 | | |
75 | 92 | | |
76 | | - | |
| 93 | + | |
77 | 94 | | |
78 | 95 | | |
79 | 96 | | |
| |||
83 | 100 | | |
84 | 101 | | |
85 | 102 | | |
86 | | - | |
| 103 | + | |
87 | 104 | | |
88 | 105 | | |
89 | 106 | | |
| |||
109 | 126 | | |
110 | 127 | | |
111 | 128 | | |
112 | | - | |
| 129 | + | |
113 | 130 | | |
114 | 131 | | |
115 | | - | |
| 132 | + | |
116 | 133 | | |
117 | 134 | | |
118 | 135 | | |
| |||
127 | 144 | | |
128 | 145 | | |
129 | 146 | | |
130 | | - | |
| 147 | + | |
131 | 148 | | |
132 | 149 | | |
133 | 150 | | |
| |||
146 | 163 | | |
147 | 164 | | |
148 | 165 | | |
149 | | - | |
| 166 | + | |
150 | 167 | | |
151 | 168 | | |
152 | | - | |
| 169 | + | |
153 | 170 | | |
154 | 171 | | |
155 | 172 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
| 74 | + | |
| 75 | + | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
45 | 49 | | |
46 | 50 | | |
47 | 51 | | |
| |||
0 commit comments