web/website/tests/staff-bureau-migration.test.mjs
Dev 6deb4a2e7d DuneRealms V2 clean baseline
Owner-authorised history reset; current source tree preserved exactly.
2026-11-13 00:05:14 +01:00

6 lines
1.1 KiB
JavaScript

import test from 'node:test';import assert from 'node:assert/strict';import {previewStaffMigration} from '../node/staff-bureau-migration.mjs';
test('legacy staff candidates are advisory and never applied',()=>{const p=previewStaffMigration({id:'x',role:'staff'});assert.equal(p.applied,false);assert.equal(p.mode,'shadow');assert.equal(p.requiresOwnerReview,true);});
test('service identity cannot silently become owner',()=>{const p=previewStaffMigration({id:'svc',ranks:['official_account','owners']});assert.equal(p.candidate,null);assert.equal(p.ambiguous,true);});
test('conflicting departments require manual review',()=>{const p=previewStaffMigration({id:'x',ranks:['web_dev','web_support']});assert.equal(p.ambiguous,true);assert.equal(p.candidate,null);});
test('known department produces reviewable candidate',()=>{const p=previewStaffMigration({id:'x',ranks:['web_support']});assert.deepEqual(p.candidate,{department:'community_moderation',level:'staff'});});
test('unknown roles do not gain staff authority',()=>{const p=previewStaffMigration({id:'x',role:'player'});assert.equal(p.candidate,null);});