Fix issue #61: Fix tests
Some checks failed
Test / test (push) Successful in 2s
Build and Deploy Nuxt / build (push) Has been cancelled

This commit is contained in:
Gitea OpenCode Agent
2026-10-15 14:20:26 +00:00
committed by Aran Roig
parent cdafd1f53a
commit 0567096588
5 changed files with 46 additions and 13 deletions

View File

@@ -82,6 +82,9 @@ function loadMapRoutes({ ownsCampaign = true, maps = [], actors = [] } = {}) {
: null
),
},
// The map list's own folder tree: `/list` reads it and `/update` checks a move
// against it, so the tokens need the model to answer, never what it answers.
"../models/Folder": { find: () => mongooseQuery([]), belongsToSection: async () => true },
});
}
@@ -188,6 +191,8 @@ function loadActorRoutes({ ownsCampaign = true, actors = [], deletedCount = 1 }
return { modifiedCount: 1 };
},
},
// The actor list's own folder tree, which the delete does not ask after.
"../models/Folder": { find: () => mongooseQuery([]), belongsToSection: async () => true },
});
return { api, tokensPulled };
}
@@ -299,10 +304,14 @@ function mapViewerTokenWiringTests() {
const sidebar = readRepoFile("frontend", "app", "components", "partials", "ContentSidebar.vue");
test("an actor row of the sidebar can be dragged out of it", () => {
const actorRow = /<div v-for="actor in actors"[^>]*>/.exec(sidebar)?.[0];
// The actors' block of the sidebar: since the entry lists got their folders the rows
// come from that tree, so the actor row holds its actor as `row.item`.
const actorSection = /<template v-else-if="activeSection === 'actors'">([\s\S]*?)<\/template>\s*\n\s*<template v-else-if="activeSection === 'items'">/
.exec(sidebar)?.[1] ?? "";
const actorRow = /<div v-else class="entity-entry"[^>]*>/.exec(actorSection)?.[0];
assert.ok(actorRow, "expected the actor rows of the sidebar");
assert.match(actorRow, /draggable="true"/);
assert.match(actorRow, /@dragstart="startActorDrag\(\$event, actor\)"/);
assert.match(actorRow, /@dragstart="startActorDrag\(\$event, row\.item\)"/);
assert.match(sidebar, /setData\(ACTOR_DRAG_TYPE, String\(actor\._id\)\)/);
});