mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-05-20 06:21:25 +00:00
Fixed:
- No longer unexpected `Unhandled Rejections` during P2P operations (waiting acceptance). CLI new features - P2P sync has been implemented.
This commit is contained in:
18
src/apps/cli/commands/p2p.unit.spec.ts
Normal file
18
src/apps/cli/commands/p2p.unit.spec.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
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"
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user