31 lines
815 B
JavaScript
31 lines
815 B
JavaScript
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,
|
|
);
|
|
});
|