MC/website/tests/staff-closure-bureau-compat.test.mjs
2026-11-27 23:43:05 +00:00

5 lines
1.4 KiB
JavaScript

import test from 'node:test';import assert from 'node:assert/strict';import {STAFF_BUREAU_DEPARTMENT_FOR_LEGACY,bureauClosureSummary,departmentAwardEarned,PERSONAL_DEPARTMENT_THRESHOLD} from '../node/staff-closure-stats.mjs';
test('all seven legacy ticket departments map into the four Staff Bureau departments',()=>{assert.equal(Object.keys(STAFF_BUREAU_DEPARTMENT_FOR_LEGACY).length,7);assert.deepEqual(new Set(Object.values(STAFF_BUREAU_DEPARTMENT_FOR_LEGACY)),new Set(['development','operations','community_moderation','administration']));});
test('historic award thresholds remain independent for each legacy department',()=>{const stats={departments:{support:24,'ban-appeals':24,'forum-support':24}};assert.equal(departmentAwardEarned(stats,'support'),false);assert.equal(departmentAwardEarned(stats,'ban-appeals'),false);assert.equal(bureauClosureSummary(stats).community_moderation,72);assert.equal(PERSONAL_DEPARTMENT_THRESHOLD,25);});
test('existing earned seals remain earned after reporting aggregation',()=>{const stats={departments:{support:25,'ban-appeals':1}};assert.equal(departmentAwardEarned(stats,'support'),true);assert.equal(departmentAwardEarned(stats,'ban-appeals'),false);assert.equal(bureauClosureSummary(stats).community_moderation,26);});
test('unknown legacy department is not silently attributed',()=>{assert.equal(bureauClosureSummary({departments:{unknown:100,dev:3}}).development,3);});