Commit 71430ed
committed
test(image): add unit tests for relative image registration edge cases
Add three test cases for relative URL image registration:
- Duplicate relative URLs: Verify that when two images with the same
relative src arrive during loading, urlToFile is only called once due
to pendingRelativeRegistrations deduplication guard.
- Fetch failure: Verify that when urlToFile returns null (network error,
404, etc.), no media store entry or rId is created, and no transaction
is dispatched.
- Exact fallback size values: Update the existing fallback size test to
assert exact EMU values (300×200 px fallback) instead of just truthy,
catching regressions if defaults are changed.
Follows Conventional Commits style per CONTRIBUTING.md guidelines.1 parent 7bef180 commit 71430ed
1 file changed
Lines changed: 48 additions & 2 deletions
File tree
- packages/super-editor/src/extensions/image/imageHelpers
Lines changed: 48 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
73 | | - | |
74 | 73 | | |
75 | 74 | | |
76 | 75 | | |
| |||
241 | 240 | | |
242 | 241 | | |
243 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
244 | 290 | | |
0 commit comments