Refactor VPN proxy components and update related behavior
This commit is contained in:
@@ -12,7 +12,12 @@ import { createStateSnapshot } from '../../.test-dist/src/shared/contracts/state
|
||||
const snapshot = (revision, desiredServerId = '', serverIds = ['one', 'two']) => ({
|
||||
apiVersion: 1,
|
||||
revision,
|
||||
selection: { desiredServerId },
|
||||
profiles: [{
|
||||
id: 'primary',
|
||||
desiredServerId,
|
||||
servers: serverIds.map((id) => ({ id })),
|
||||
}],
|
||||
selection: { desiredProfileId: 'primary', desiredServerId },
|
||||
servers: serverIds.map((id) => ({ id })),
|
||||
});
|
||||
|
||||
@@ -87,21 +92,10 @@ test('an equal revision keeps the current snapshot identity', () => {
|
||||
assert.equal(next.snapshot.selection.desiredServerId, 'one');
|
||||
});
|
||||
|
||||
test('pending selection survives polling until canonical state acknowledges it', () => {
|
||||
let state = receive(initialHarborState, snapshot(1, 'one'));
|
||||
state = harborReducer(state, { type: 'select-server', serverId: 'two' });
|
||||
state = receive(state, snapshot(2, 'one'));
|
||||
assert.equal(state.pendingServerId, 'two');
|
||||
|
||||
state = receive(state, snapshot(3, 'two'));
|
||||
assert.equal(state.pendingServerId, '');
|
||||
});
|
||||
|
||||
test('pending selection is cleared when its server disappears', () => {
|
||||
let state = receive(initialHarborState, snapshot(1, 'one'));
|
||||
state = harborReducer(state, { type: 'select-server', serverId: 'two' });
|
||||
|
||||
assert.equal(receive(state, snapshot(2, 'one', ['one'])).pendingServerId, '');
|
||||
test('selection has no client-side shadow and follows canonical profile snapshots', () => {
|
||||
const state = receive(initialHarborState, snapshot(2, 'two'));
|
||||
assert.equal(Object.hasOwn(state, 'pendingServerId'), false);
|
||||
assert.equal(state.snapshot.profiles[0].desiredServerId, 'two');
|
||||
});
|
||||
|
||||
test('data invariant: initial control outage is retryable without a fabricated snapshot', () => {
|
||||
|
||||
Reference in New Issue
Block a user