feat: add guild.host importer#58
Conversation
|
Hey, This mostly looks good, Thanks for contributing! Just a couple of gotchas I think need to be addressed and this one:
|
Co-authored-by: Tom Scanlan <3408465+tompscanlan@users.noreply.github.com>
Co-authored-by: Tom Scanlan <3408465+tompscanlan@users.noreply.github.com>
ah! description is a good call, fixed it here |
Guild returns `uploadedSocialCard: null` (not absent) for events with no uploaded card — e.g. the live event London GraphQL Spring 2026 — which `v.optional` rejects, throwing and 502-ing the whole import. `v.nullish` accepts null and undefined; the existing `?? generatedSocialCardURL` fallback then covers it.
Add src/lib/import/test-support.ts, a source-agnostic fetch-mock harness (ordered route table; unmatched URLs throw so no test escapes to the network) with jsonReply / imageReply / textReply / fetchedPage / importContext / blockRealFetch helpers, and use it to cover every importer: - guild: real captured API fixtures, host-match accept matrix, a pipeline test proving a guild URL routes straight to the JSON API with no wasted HTML-page fetch, and a regression test for the null-uploadedSocialCard generated-card fallback. - raco: GraphQL POST body/header assertions + venue-zone offset mapping. - ical: text/calendar and BEGIN:VCALENDAR content sniffing, TZID-aware start/end mapping, and full-pipeline routing. - webpage: JSON-LD extraction, OpenGraph fallback, offset -> IANA-zone guess. blockRealFetch() installs a throwing fetch before each test, so a test that forgets stubFetch() fails loudly instead of hitting the internet. Adding a new importer's tests is: capture a real response as a fixture, list its routes, assert the mapped prefill. Each importer test was checked against an injected regression via mutation testing.
|
Pushed two commits directly (maintainer edit) rather than leaving you to hand-apply — shout if you'd rather I back either out:
Adding the next importer's tests is: capture a real response as a fixture, list its routes, assert the mapped prefill. |
|
ty! assuming this will be squashed merged perhaps your LLM should move the unrelated tests should be in a seperate PR? |
|
You caught me :) I was hoping to smuggle the whole thing in one merge to save a step, but I can do better :) I'll split it out when I get a minute |
A source-agnostic fetch-mock harness (test-support.ts) stubs the global fetch with an ordered route table, so an importer can be driven against captured fixtures with zero live network — an unstubbed fetch throws (blockRealFetch). On top of it, regression tests for the pre-existing raco / ical / webpage importers. This is the reusable test infrastructure factored out of #58 so the guild.host importer PR carries only its own code and tests. Land this first; #58 rebases onto it and keeps just the guild importer + its tests. 19 tests, `npm test` green, no network.
Adds a direct integration with guild.host for a slightly better import result