Integration Test: Single Data Source Database
Run an integration test using the single-data-source test database (2fe57008-e885-8003-b1f3-cc05981dc6b0).
- •Notion URL: https://www.notion.so/2fe57008e8858003b1f3cc05981dc6b0
- •Reference:
.claude/reference/test-databases/single-data-source/
Mode
Check if --verbose was passed in the skill args.
- •Default (concise): Run all steps automatically without asking questions. Print a one-line status per step as you go (e.g.,
Step 1: Clean slate... done). At the end, print the summary table and pass/fail result. Do NOT useAskUserQuestionat all. - •Verbose (
--verbose): Interactive mode. UseAskUserQuestionwith selectable options before every command. Show exact CLI calls, wait for confirmation, and provide detailed Git Analysis after each action. Never jump ahead. - •No cleanup (
--no-cleanup): Skip Step 11 (deletetest-output/). The test output is left on disk so you can examine it manually.
Verbose-Only Interaction Rules
These rules only apply in --verbose mode:
- •Always use
AskUserQuestionwith selectable options — never ask questions as plain text. - •Before running any command, show the exact CLI call and use
AskUserQuestionto confirm. - •Never jump ahead — always wait for my selection between steps.
- •Git Analysis after every action — run
git diff --statand provide a "Git Analysis:" section summarizing what git sees. This is inline with each step, not a separate step.
Steps
Step 0: Build
Run: go build ./cmd/notion-sync
- •Pass criteria: exit code 0,
notion-sync.exeexists.
Step 1: Clean slate
- •If
test-output/test database obsdiain complex/exists: delete only that subfolder (in verbose mode, ask first). - •If it doesn't exist: skip.
- •Important: Do NOT delete
test-output/itself or any other subfolders — other test databases may live there.
Step 2: Fresh import
Run: ./notion-sync.exe import 2fe57008-e885-8003-b1f3-cc05981dc6b0 --output ./test-output
- •Pass criteria: created > 0, exit code 0.
Step 3: No-op refresh
Run: ./notion-sync.exe refresh "./test-output/test database obsdiain complex"
- •Pass criteria: updated = 0, skipped = total, deleted = 0.
Step 4: Make a change via Notion MCP
Use the Notion MCP tools to make both a property edit and a content edit to one of the pages. Property-only edits may not bump Notion's last_edited_time, so you must also edit the page content (e.g., append <!-- sync-test -->) to ensure the timestamp changes.
Remember the original values so you can revert in Step 10.
Step 5: Incremental refresh
Run: ./notion-sync.exe refresh "./test-output/test database obsdiain complex"
- •Pass criteria: updated = 1 (the edited page), skipped = total - 1.
Step 6: Test --ids flag
Pick a page ID from the synced files. Run:
./notion-sync.exe refresh "./test-output/test database obsdiain complex" --ids <page-id>
- •Pass criteria: updated = 1, skipped = 0.
Step 7: Test --force flag
Run: ./notion-sync.exe refresh "./test-output/test database obsdiain complex" --force
- •Pass criteria: updated = total, skipped = 0.
Step 8: Verify property output
Grep the synced .md files in ./test-output/test database obsdiain complex/ for the following frontmatter keys and validate:
| Key | Check |
|---|---|
unique_id | Present in at least one file, value matches pattern PREFIX-N or just N (digits) |
created_by | Present in at least one file, value is a non-empty string (user name or ID) |
last_edited_by | Present in at least one file, value is a non-empty string (user name or ID) |
- •Pass criteria: All 3 keys found with valid non-null values.
Step 9: Verify file mtime preservation
For each synced .md file, compare the file's modification time (via stat) against the notion-last-edited value in its frontmatter.
- •Pass criteria: File mtime matches
notion-last-editedtimestamp (within 1-second tolerance).
Step 10: Verify SQLite database
Query _notion_sync.db at test-output/ root using sqlite3 (read-only):
| Check | Expected |
|---|---|
| Total page count for this database | 11 (SELECT COUNT(*) FROM pages WHERE database_id = '2fe57008-e885-8003-b1f3-cc05981dc6b0') |
All pages have non-empty body_markdown | SELECT COUNT(*) FROM pages WHERE database_id = '2fe57008-e885-8003-b1f3-cc05981dc6b0' AND (body_markdown IS NULL OR body_markdown = '') = 0 |
All pages have non-empty last_edited_time | SELECT COUNT(*) FROM pages WHERE database_id = '2fe57008-e885-8003-b1f3-cc05981dc6b0' AND (last_edited_time IS NULL OR last_edited_time = '') = 0 |
| FTS index has entries | SELECT COUNT(*) FROM pages_fts >= 11 |
- •Pass criteria: All checks pass.
Step 11: Revert Notion changes
Use Notion MCP tools to restore the page edited in Step 4 back to its original property values and content. This keeps the test database clean for the next run.
Step 12: Clean up
If --no-cleanup was passed, skip this step and print Step 12: Skipped (--no-cleanup).
Otherwise:
- •Delete only
test-output/test database obsdiain complex/(not the entiretest-output/directory). - •Clean SQLite: delete rows from
pagestable intest-output/_notion_sync.dbwheredatabase_idmatches this test's database ID (2fe57008-e885-8003-b1f3-cc05981dc6b0). Use Python or Go to run the SQL. - •If
_notion_sync.dbhas zero rows remaining inpages, delete the.dbfile entirely. - •If
test-output/is now empty, delete it.
Done
Summarize all step results in a table with columns: Step | Action | Result.
If all steps passed, output:
✅ ALL TESTS PASSED
If any steps failed, output:
❌ TESTS FAILED
followed by a bullet list of each failed step and what went wrong.