From 6e408f96a7e38ade6644a7e1c9b7ee1906d01bf9 Mon Sep 17 00:00:00 2001 From: Hernan Date: Thu, 15 Oct 2026 15:16:24 -0300 Subject: [PATCH] test(configAPI): Robot kind apply -> clear -> re-apply sequence Covers the pose lifecycle: re-applying a ghost without a pose keeps the old one; after a clear, the pose is gone. Co-Authored-By: Claude Fable 5.1 --- .../server/test/configAPI/configAPIRobot.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/imports/server/test/configAPI/configAPIRobot.test.js b/app/imports/server/test/configAPI/configAPIRobot.test.js index 9298a65..f81b632 100644 --- a/app/imports/server/test/configAPI/configAPIRobot.test.js +++ b/app/imports/server/test/configAPI/configAPIRobot.test.js @@ -150,6 +150,18 @@ describe('configAPI:Robot kind', () => { expect(await Robots.find({}).countAsync()).to.equal(1); }); + it('apply: a ghost re-applied without a pose keeps its old pose until cleared', async () => { + const { pose, ...noPose } = GHOST_SPEC; + await configApi.apply({ configObject: robotObject('g1', GHOST_SPEC), user: manager }); + await configApi.apply({ configObject: robotObject('g1', noPose), user: manager }); + expect((await RobotLocalization.findOneAsync({ _id: 'g1' })).robotPose.x).to.equal(4.2); + + await configApi.clear({ configObject: robotObject('g1'), user: manager }); + await configApi.apply({ configObject: robotObject('g1', noPose), user: manager }); + expect(await RobotLocalization.findOneAsync({ _id: 'g1' })).to.equal(undefined); + expect((await Robots.findOneAsync({ _id: 'g1' })).updateStamp).to.equal(GHOST_TS); + }); + it('clear: removes a ghost and all of its static data', async () => { await configApi.apply({ configObject: robotObject('g1', GHOST_SPEC), user: manager }); await configApi.clear({ configObject: robotObject('g1'), user: manager });