mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-04-27 19:38:37 +00:00
- No longer unexpected `Unhandled Rejections` during P2P operations (waiting acceptance). CLI new features - P2P sync has been implemented.
19 lines
674 B
TypeScript
19 lines
674 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { parseTimeoutSeconds } from "./p2p";
|
|
|
|
describe("p2p command helpers", () => {
|
|
it("accepts non-negative timeout", () => {
|
|
expect(parseTimeoutSeconds("0", "p2p-peers")).toBe(0);
|
|
expect(parseTimeoutSeconds("2.5", "p2p-sync")).toBe(2.5);
|
|
});
|
|
|
|
it("rejects invalid timeout values", () => {
|
|
expect(() => parseTimeoutSeconds("-1", "p2p-peers")).toThrow(
|
|
"p2p-peers requires a non-negative timeout in seconds"
|
|
);
|
|
expect(() => parseTimeoutSeconds("abc", "p2p-sync")).toThrow(
|
|
"p2p-sync requires a non-negative timeout in seconds"
|
|
);
|
|
});
|
|
});
|