Files

31 lines
815 B
JavaScript
Raw Permalink Normal View History

2026-07-26 19:51:44 +08:00
import assert from 'node:assert/strict';
import test from 'node:test';
import {
isPassiveCanaryRuntime,
resolvePortalRuntimeRole,
} from './portal-runtime-role.mjs';
test('runtime role defaults to stable and rejects unknown values', () => {
assert.equal(resolvePortalRuntimeRole({}), 'stable');
assert.equal(resolvePortalRuntimeRole({ MEMIND_RUNTIME_ROLE: 'unknown' }), 'stable');
});
test('candidate runtime is passive unless explicitly disabled', () => {
assert.equal(
isPassiveCanaryRuntime({ MEMIND_RUNTIME_ROLE: 'candidate' }),
true,
);
assert.equal(
isPassiveCanaryRuntime({
MEMIND_RUNTIME_ROLE: 'candidate',
MEMIND_CANARY_PASSIVE_RUNTIME: '0',
}),
false,
);
assert.equal(
isPassiveCanaryRuntime({ MEMIND_RUNTIME_ROLE: 'stable' }),
false,
);
});