Files
monkey-ai-web/tests/cloudBrainUiFlag.test.js
T
2026-10-15 16:33:46 +08:00

48 lines
1.7 KiB
JavaScript

/*
Copyright (C) 2025 QuantumNous
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For commercial licensing, please contact support@quantumnous.com
*/
import assert from 'node:assert/strict';
import test from 'node:test';
import {
CLOUD_BRAIN_UI_ENABLED,
isCloudBrainOrgModule,
isCloudBrainOrgPath,
parseFrontendBoolean,
} from '../src/config/cloudBrainUi.js';
test('cloud brain UI is fail-closed when the build flag is absent', () => {
assert.equal(CLOUD_BRAIN_UI_ENABLED, false);
});
test('frontend build flag accepts only explicit truthy values', () => {
assert.equal(parseFrontendBoolean('true'), true);
assert.equal(parseFrontendBoolean('1'), true);
assert.equal(parseFrontendBoolean('yes'), true);
assert.equal(parseFrontendBoolean('false'), false);
assert.equal(parseFrontendBoolean(undefined), false);
});
test('cloud brain organization routes and modules are centrally classified', () => {
assert.equal(isCloudBrainOrgModule('knowledge'), true);
assert.equal(isCloudBrainOrgModule('dashboard'), false);
assert.equal(isCloudBrainOrgPath('/org/effectiveness'), true);
assert.equal(isCloudBrainOrgPath('/org/members'), false);
});