CLI Integration tests#165
Merged
Merged
Conversation
2bf77ed to
30cb649
Compare
jules-exel
approved these changes
Jun 17, 2026
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.
Adds integration scenario tests for the cli pipeline
What this is
A fixture-driven integration test runner under
src/tests/sync/that exercises the actual CLI sync pipeline against on-disk scenario state. Sixteen scenarios cover the main code paths for content items, models, and containers — each one represents a real-world condition (fresh sync, re-sync, conflicts, missing target files, selective sync via--models-with-deps, etc.).These complement the existing unit tests: unit tests verify individual functions in isolation; scenarios verify the orchestration chain end-to-end.
What's "real" vs what's mocked
Real (not mocked):
ContentBatchProcessor,pushModels,pushContainers,filterContentItemsForProcessing, change-detection, mappersModelDependencyTreeBuilder(for selective-sync scenarios)fileOperationsclassMocked at the network boundary:
apiClient.contentMethods.saveContentItemsapiClient.modelMethods.saveModelapiClient.containerMethods.saveContainerpollBatchUntilComplete/extractContentBatchResultsThe mock (
helpers/mock-api-client.ts) captures every API call's payload and returns deterministic new IDs (e.g., new content items get target IDs starting at 9001, new models at 7001, new containers at 8001). This lets scenarios assert exactly which payloads were sent and which mappings landed on disk, without needing a live Agility instance.How a scenario works
Each scenario is a directory under
src/tests/sync/scenarios/:scenario.jsondeclares:base(shared fixtures to inherit from)pushes("content"|"models"|"containers") andmodelsWithDepsfor selective syncstateoverrides (e.g.,overwrite: true)expectblock — number of API calls, expected mapping shape, duplicate-detection flagAt test time, the runner:
_base/into a fresh temp directory (if the scenario opts in)state/on top (scenario files override base)state.rootPathat that temp directoryscenario.json'sexpectblockWhat's enforced by each scenario
--models-with-deps="Post"excludes unrelated Author itemsbatchSize: 2, 5 items → 3 batches)pushContainers