mirror of https://github.com/openclaw/openclaw.git
test: tighten node list parse fallback coverage
This commit is contained in:
parent
91f725a998
commit
4d523f4e19
|
|
@ -23,4 +23,26 @@ describe("shared/node-list-parse", () => {
|
||||||
expect(parsePairingList(undefined)).toEqual({ pending: [], paired: [] });
|
expect(parsePairingList(undefined)).toEqual({ pending: [], paired: [] });
|
||||||
expect(parsePairingList(["not-an-object"])).toEqual({ pending: [], paired: [] });
|
expect(parsePairingList(["not-an-object"])).toEqual({ pending: [], paired: [] });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("preserves valid pairing arrays when the sibling field is malformed", () => {
|
||||||
|
expect(
|
||||||
|
parsePairingList({
|
||||||
|
pending: [{ requestId: "r1", nodeId: "n1", ts: 1 }],
|
||||||
|
paired: "x",
|
||||||
|
}),
|
||||||
|
).toEqual({
|
||||||
|
pending: [{ requestId: "r1", nodeId: "n1", ts: 1 }],
|
||||||
|
paired: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
parsePairingList({
|
||||||
|
pending: 1,
|
||||||
|
paired: [{ nodeId: "n1" }],
|
||||||
|
}),
|
||||||
|
).toEqual({
|
||||||
|
pending: [],
|
||||||
|
paired: [{ nodeId: "n1" }],
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue