|
1 | 1 | import { assertEquals, assertInstanceOf } from "@std/assert";
|
2 | 2 | import { afterAll, beforeAll, describe, it } from "@std/testing/bdd";
|
3 |
| -import { NostrEvent } from "../core/protocol.ts"; |
4 |
| -import { Relay } from "../core/relays.ts"; |
5 |
| -import { RelayGroup } from "../std/relays.ts"; |
6 |
| -import { MockWebSocket } from "../lib/testing.ts"; |
| 3 | +import { MockWebSocket } from "@lophus/lib/testing"; |
| 4 | +import type { NostrEvent } from "@lophus/core/protocol"; |
| 5 | +import { Relay } from "@lophus/core/relays"; |
| 6 | +import { RelayPool } from "./pools.ts"; |
7 | 7 |
|
8 |
| -describe("RelayGroup", () => { |
| 8 | +describe("RelayPool", () => { |
9 | 9 | let relays: Relay[];
|
10 |
| - let group: RelayGroup; |
| 10 | + let group: RelayPool; |
11 | 11 | let sub: ReadableStream<NostrEvent>;
|
12 | 12 |
|
13 | 13 | // ----------------------
|
@@ -42,26 +42,26 @@ describe("RelayGroup", () => {
|
42 | 42 | // ----------------------
|
43 | 43 |
|
44 | 44 | it("should create a group of relays", () => {
|
45 |
| - group = new RelayGroup(relays); |
46 |
| - assertInstanceOf(group, RelayGroup); |
| 45 | + group = new RelayPool(relays); |
| 46 | + assertInstanceOf(group, RelayPool); |
47 | 47 | });
|
48 | 48 | it("should not have a url", () => {
|
49 |
| - // @ts-expect-error RelayGroup does not have a url |
| 49 | + // @ts-expect-error RelayPool does not have a url |
50 | 50 | assertEquals(group.url, undefined);
|
51 | 51 | });
|
52 | 52 | it("should have a default name", () => {
|
53 | 53 | assertEquals(group.config.name, "relay-1, relay-2, relay-3");
|
54 | 54 | });
|
55 | 55 | it("should have a custom name if provided", () => {
|
56 |
| - const group = new RelayGroup(relays, { name: "custom" }); |
| 56 | + const group = new RelayPool(relays, { name: "custom" }); |
57 | 57 | assertEquals(group.config.name, "custom");
|
58 | 58 | });
|
59 | 59 | it("should have default read and write config", () => {
|
60 | 60 | assertEquals(group.config.read, true);
|
61 | 61 | assertEquals(group.config.write, true);
|
62 | 62 | });
|
63 | 63 | it("should have custom read and write config if provided", () => {
|
64 |
| - const group = new RelayGroup(relays, { read: false, write: false }); |
| 64 | + const group = new RelayPool(relays, { read: false, write: false }); |
65 | 65 | assertEquals(group.config.read, false);
|
66 | 66 | assertEquals(group.config.write, false);
|
67 | 67 | });
|
|
0 commit comments