Add gateway auto toggle for client mode
This commit is contained in:
@@ -5,6 +5,7 @@ import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
import {
|
||||
applyGatewayPreference,
|
||||
buildGatewayPresence,
|
||||
createGatewayAutoState,
|
||||
nextGatewayAutoState,
|
||||
@@ -107,3 +108,17 @@ test('host route freshness and Gateway failures drive a safe automatic fallback'
|
||||
}));
|
||||
assert.equal(readHostNetworkState(statePath, { now }), null);
|
||||
});
|
||||
|
||||
test('client can ignore and restore a verified Gateway without losing discovery', () => {
|
||||
const detected = {
|
||||
...createGatewayAutoState(),
|
||||
mode: 'gateway-direct',
|
||||
gatewayId: 'gateway-1',
|
||||
};
|
||||
|
||||
const ignored = applyGatewayPreference(detected, false);
|
||||
assert.equal(ignored.mode, 'local-vpn');
|
||||
assert.equal(ignored.gatewayId, 'gateway-1');
|
||||
assert.equal(applyGatewayPreference(ignored, true).mode, 'gateway-direct');
|
||||
assert.equal(applyGatewayPreference(createGatewayAutoState(), true).mode, 'local-vpn');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user