fix: harden mac nordvpn status inference
This commit is contained in:
@@ -23,6 +23,8 @@ module.exports = {
|
||||
typeof isMacTailscaleActive === "function" ? isMacTailscaleActive : undefined,
|
||||
normalizeSuccessfulConnectState:
|
||||
typeof normalizeSuccessfulConnectState === "function" ? normalizeSuccessfulConnectState : undefined,
|
||||
normalizeStatusState:
|
||||
typeof normalizeStatusState === "function" ? normalizeStatusState : undefined,
|
||||
sanitizeOutputPayload:
|
||||
typeof sanitizeOutputPayload === "function" ? sanitizeOutputPayload : undefined,
|
||||
shouldAttemptMacWireguardDisconnect:
|
||||
@@ -204,6 +206,33 @@ test("normalizeSuccessfulConnectState marks the connect snapshot active after ve
|
||||
assert.equal(state.wireguard.endpoint, "de1227.nordvpn.com:51820");
|
||||
});
|
||||
|
||||
test("normalizeStatusState marks macOS wireguard connected when public IP matches the last successful target", () => {
|
||||
const { normalizeStatusState } = loadInternals();
|
||||
assert.equal(typeof normalizeStatusState, "function");
|
||||
|
||||
const state = normalizeStatusState({
|
||||
platform: "darwin",
|
||||
controlMode: "wireguard",
|
||||
connected: false,
|
||||
wireguard: {
|
||||
active: false,
|
||||
endpoint: "tr73.nordvpn.com:51820",
|
||||
lastConnection: {
|
||||
requestedTarget: { country: "Turkey", city: "" },
|
||||
resolvedTarget: { country: "Turkey", city: "Istanbul" },
|
||||
},
|
||||
},
|
||||
publicIp: {
|
||||
ok: true,
|
||||
country: "Turkey",
|
||||
city: "Istanbul",
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(state.connected, true);
|
||||
assert.equal(state.wireguard.active, true);
|
||||
});
|
||||
|
||||
test("sanitizeOutputPayload redacts local path metadata from normal JSON output", () => {
|
||||
const { sanitizeOutputPayload } = loadInternals();
|
||||
assert.equal(typeof sanitizeOutputPayload, "function");
|
||||
|
||||
Reference in New Issue
Block a user