fix: stabilize mac nordvpn state reporting
This commit is contained in:
@@ -21,6 +21,8 @@ module.exports = {
|
||||
typeof getMacTailscalePath === "function" ? getMacTailscalePath : undefined,
|
||||
isMacTailscaleActive:
|
||||
typeof isMacTailscaleActive === "function" ? isMacTailscaleActive : undefined,
|
||||
normalizeSuccessfulConnectState:
|
||||
typeof normalizeSuccessfulConnectState === "function" ? normalizeSuccessfulConnectState : undefined,
|
||||
shouldAttemptMacWireguardDisconnect:
|
||||
typeof shouldAttemptMacWireguardDisconnect === "function" ? shouldAttemptMacWireguardDisconnect : undefined,
|
||||
detectMacWireguardActiveFromIfconfig:
|
||||
@@ -167,6 +169,39 @@ test("shouldAttemptMacWireguardDisconnect does not trust active=false when resid
|
||||
);
|
||||
});
|
||||
|
||||
test("normalizeSuccessfulConnectState marks the connect snapshot active after verified macOS wireguard connect", () => {
|
||||
const { normalizeSuccessfulConnectState } = loadInternals();
|
||||
assert.equal(typeof normalizeSuccessfulConnectState, "function");
|
||||
|
||||
const state = normalizeSuccessfulConnectState(
|
||||
{
|
||||
platform: "darwin",
|
||||
controlMode: "wireguard",
|
||||
connected: false,
|
||||
wireguard: {
|
||||
active: false,
|
||||
endpoint: null,
|
||||
},
|
||||
},
|
||||
{
|
||||
backend: "wireguard",
|
||||
server: {
|
||||
hostname: "de1227.nordvpn.com",
|
||||
},
|
||||
},
|
||||
{
|
||||
ok: true,
|
||||
ipInfo: {
|
||||
country: "Germany",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
assert.equal(state.connected, true);
|
||||
assert.equal(state.wireguard.active, true);
|
||||
assert.equal(state.wireguard.endpoint, "de1227.nordvpn.com:51820");
|
||||
});
|
||||
|
||||
test("isMacTailscaleActive treats Running backend as active", () => {
|
||||
const { isMacTailscaleActive } = loadInternals();
|
||||
assert.equal(typeof isMacTailscaleActive, "function");
|
||||
|
||||
Reference in New Issue
Block a user