Update Harbor client and gateway functionality
This commit is contained in:
@@ -67,6 +67,30 @@ test('typed Harbor client validates unknown state and isolates wire compatibilit
|
||||
assert.equal(failed.transport.bootStatus, 'incompatible-api');
|
||||
});
|
||||
|
||||
test('an old rules snapshot remains readable but keeps the mutation capability absent', () => {
|
||||
const current = createStateSnapshot({
|
||||
storedState: {
|
||||
routeRules: [{ type: 'domain', value: 'example.com', enabled: true, outbound: 'direct' }],
|
||||
appliedRouteRules: [{ type: 'domain', value: 'example.com', enabled: true, outbound: 'direct' }],
|
||||
},
|
||||
runtime: { running: true },
|
||||
gatewayAuto: null,
|
||||
appMode: 'client',
|
||||
configExists: true,
|
||||
now: new Date('2026-08-17T12:00:00.000Z'),
|
||||
});
|
||||
const legacy = structuredClone(current);
|
||||
delete legacy.route.rulesContractVersion;
|
||||
for (const rule of [...legacy.route.localRules, ...legacy.route.activeLocalRules]) delete rule.outbound;
|
||||
|
||||
const parsed = parseHarborState(legacy);
|
||||
assert.equal(parsed.route.rulesContractVersion, undefined);
|
||||
assert.deepEqual(parsed.route.localRules, [
|
||||
{ type: 'domain', value: 'example.com', enabled: true, outbound: 'direct' },
|
||||
]);
|
||||
assert.equal(parseHarborState(current).route.rulesContractVersion, 2);
|
||||
});
|
||||
|
||||
test('data invariant: an older polling promise cannot replace a newer mutation snapshot', async () => {
|
||||
let state = receive(initialHarborState, snapshot(1, 'one'));
|
||||
const poll = deferred();
|
||||
|
||||
Reference in New Issue
Block a user