test: add behavior tests for connectors - #27
Open
Chemaclass wants to merge 5 commits into
Open
Conversation
Chemaclass
force-pushed
the
test/connector-behavior-tests
branch
3 times, most recently
from
June 24, 2026 15:22
cc014d2 to
fbe8c59
Compare
Chemaclass
force-pushed
the
test/connector-behavior-tests
branch
2 times, most recently
from
June 24, 2026 15:38
eff9ee6 to
3d999da
Compare
Happy-path tests for serializeRecording/idOf and keepRecording (GRAIN_AFTER cutoff + shouldSync), network-free.
Tests serializeNote frontmatter and both transcript disclaimer branches, plus idOf/updatedAtOf round-trips, network-free.
Tests serializePage/sanitizeBody/computePaths and normalizeValue/normalizeProperties/personRef/summarizeSchema across Notion property types, network-free.
Tests serializeTicket/serializeAccount ordering and links, filename slugs, and parse* round-trips, network-free.
Tests repoName/remoteUrl; exports them and guards the auto-run with import.meta.main so helpers import cleanly under test.
Chemaclass
force-pushed
the
test/connector-behavior-tests
branch
from
June 24, 2026 15:47
3d999da to
6bf84b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR — how much to trust the test data
These are characterization tests: they lock in the connectors' current observable behaviour rather than verify against live APIs. The fixtures are hand-built inputs typed against each connector's client interfaces, so the tests run with no real connection to Notion, Grain, Granola, Pylon, etc.
Confidence is two-layered:
Partial<Recording>,Partial<PylonIssue>,Partial<Note>,NotionNode), sotscrejects any fixture that drifts from its interface. Values are realistic (ISO timestamps, UUID-shaped ids, Slackmessage_tsformat, Pyloncustom_fieldsvalue/values split, Granola source enum).Soft spots to know about:
notion/properties.test.tscasts property fixturesas never, bypassing type checking (plausible but unprotected); the HTTP/JSON-parse client layer is still ~0% covered.To close the type-vs-reality gap later (when a real connection is available): capture one sanitized real response per source as a recorded JSON fixture and run it through the client's
.json()parse + serializer once.What
Adds happy-path, behavior-focused unit tests for the connectors that previously had no coverage. One commit per connector.
serializeRecording/idOf,keepRecording(GRAIN_AFTER cutoff + shouldSync)serializeNote(both transcript disclaimer branches),idOf/updatedAtOfserializePage/sanitizeBody/computePaths+ property normalization across all Notion typesserializeTicket/serializeAccountordering & links, filename slugs,parse*round-tripsrepoName/remoteUrlURL helpersApproach
Date.now).bun:test, inline snapshots,toContain, round-trips).repo/sync.ts: exportedrepoName/remoteUrland guarded the auto-run withimport.meta.mainso helpers import cleanly under test (CI invocation unaffected).Verification
bun test→ 103 pass / 0 fail. Lint, typecheck, and prettier all clean.Note
Low Risk
Changes are overwhelmingly new tests; the small
sync.tsexport/guard is a standard testability pattern with minimal runtime impact when run as the main script.Overview
Adds behavior-focused unit tests (
bun:test, fixtures, inline snapshots, round-trips) for connectors that previously had little or no coverage: Grain (keepRecordingcutoff rules; recording markdown/idOf), Granola (note serialization, transcript disclaimers,idOf/updatedAtOf), Notion (paths, body sanitization, page frontmatter, property normalization), Pylon (tickets/accounts, filenames, parsers), and repo URL helpers.The only production tweak is in
repo/sync.ts:repoNameandremoteUrlare exported for testing, andsyncRepoauto-run is wrapped inimport.meta.mainso importing the module in tests does not trigger a sync (CLI/CI entry unchanged).Reviewed by Cursor Bugbot for commit 6bf84b7. Bugbot is set up for automated code reviews on this repo. Configure here.