Fix tests #61
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
There are failing tests, can you fix them?
All tests pass now: 210/210 (was 166/189 passing with 23 failures).
What was broken and what I changed
One real bug in the code —
dragonroll-foundry/scripts/api.js:initializeCharacterSync()'s error handler calledscheduleDragonrollCharacterSync(15000), which was never defined. So a startup sync that could not reach Dragonroll died withReferenceError: scheduleDragonrollCharacterSync is not defined— masking the real error and never retrying. Added the scheduler next to the reconcile it schedules, mirroring the existingscheduleSnapshotSync(tracked timeout so repeated failures collapse to one pending retry). Verified by loading the module in a stubbed Foundry world: the failure now logsCharacter sync failed and will retry.with the actual error.Tests that had drifted from code that landed since (
routes/foundry-link.jshashes its sync token, the map/actor routes gained the shared per-section folder tree, and the sidebar rows come from that tree):tests/item-folder-sync.test.js: dropped an unneeded top-levelawaitthat made Node treat the whole CommonJS file as an ES module (every test in it failed before running); handed the stubbedrequirethenode:cryptothe route now needs; seeded fake documents with the campaign they belong to, liketests/entry-folders.test.jsdoes, since the routes scope every lookup by campaign; gave the sandbox actor theupdate/updateEmbeddedDocumentsthe push path calls.tests/map-pins.test.js,tests/map-tokens.test.js: stubbed../models/Folderfor the map and actor routers, andFolder.filterForTargetfor the note router.tests/map-tokens.test.js/tests/item-sheet-window.test.js: locate the actor and item rows as the entry rows of their section (@dragstart="startActorDrag($event, row.item)",v-for="row in entryRows.item.value") instead of the pre-folder-tree markup.Two assertions that could never pass in
tests/item-folder-sync.test.js, fixed to test what they describe:shape.includes(["item", "Torch"])compares array identities, so it was always false; and a row object was destructured with an array pattern (rows.filter(([kind]) => …)), which throws. Both now read from the mappedshape.Pistolin a folder at depth 1 whileLongswordin one at depth 0 was also 1) and listedLongswordafter the rootTorch, outside its own folder. It now asserts the orderBuildItemRowsdocuments: each folder followed by what stands in it, one step deeper, root items last.I changed no app behaviour beyond the retry fix, and did not commit — the automation handles that.
Implementation is ready for review: #68