Skip to content

Commit 58fff3f

Browse files
committed
fix tests
1 parent 3e5cfb9 commit 58fff3f

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

packages/editor/src/store/BackgroundSyncer.browsertest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("BackgroundSyncer tests", () => {
3535
});
3636

3737
beforeEach(async () => {
38-
wsProvider = createWsProvider();
38+
wsProvider = createWsProvider("ws://localhost:1234");
3939

4040
// initialize the main user we're testing
4141
// await coordinator.initialize();

packages/editor/src/store/DocConnection.browsertest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe("DocConnection tests", () => {
3636
});
3737

3838
beforeEach(async () => {
39-
wsProvider = createWsProvider();
39+
wsProvider = createWsProvider("ws://localhost:1234");
4040

4141
// initialize the main user we're testing
4242
// await coordinator.initialize();

packages/editor/src/store/yjs-sync/SyncManager.browsertest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ describe("SyncManager tests", () => {
111111

112112
beforeEach(async () => {
113113
TypeCellRemote.Offline = false;
114-
wsProvider = createWsProvider();
114+
wsProvider = createWsProvider("ws://localhost:1234");
115115

116116
// initialize the main user we're testing
117117
// await coordinator.initialize();

packages/server/src/hocuspocus/extension-supabase/hocuspocus.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ import {
1010
} from "../../supabase/test/supabaseTestUtil";
1111
import { SupabaseHocuspocus } from "./SupabaseHocuspocus";
1212

13+
let server: typeof Server;
1314
beforeAll(async () => {
1415
// await resetSupabaseDB();
15-
const server = Server.configure({
16+
server = Server.configure({
1617
extensions: [new SupabaseHocuspocus({})],
1718
debounce: 0,
1819
});
19-
await server.listen(1234);
20+
await server.listen(0); // 0 for random port
2021
});
2122
/*
2223
it("should sync user data via yjs", async () => {
@@ -92,7 +93,7 @@ describe("SupabaseHocuspocus", () => {
9293
it.skip("should sync when Alice reopens", async () => {
9394
const ydoc = new Y.Doc();
9495

95-
const wsProvider = createWsProvider(ws);
96+
const wsProvider = createWsProvider(server.URL, ws);
9697

9798
const provider = createHPProvider(
9899
docId,
@@ -121,7 +122,7 @@ describe("SupabaseHocuspocus", () => {
121122
it.skip("should sync when Alice opens 2 connections", async () => {
122123
const ydoc = new Y.Doc();
123124

124-
const wsProvider = createWsProvider(ws);
125+
const wsProvider = createWsProvider(server.URL, ws);
125126

126127
const provider = createHPProvider(
127128
docId,
@@ -149,7 +150,7 @@ describe("SupabaseHocuspocus", () => {
149150
it.skip("should not sync to Bob", async () => {
150151
const ydoc = new Y.Doc();
151152

152-
const wsProvider = createWsProvider(ws);
153+
const wsProvider = createWsProvider(server.URL, ws);
153154

154155
const provider = createHPProvider(
155156
docId,
@@ -224,7 +225,7 @@ describe("SupabaseHocuspocus", () => {
224225
it.skip("should add and remove refs to database", async () => {
225226
const ydoc = new Y.Doc();
226227

227-
const wsProvider = createWsProvider(ws);
228+
const wsProvider = createWsProvider(server.URL, ws);
228229

229230
const provider = createHPProvider(
230231
docId,

packages/server/src/supabase/test/supabaseTestUtil.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ export async function createRandomUser(
5050
};
5151
}
5252

53-
export function createWsProvider(ws?: any) {
53+
export function createWsProvider(url: string, ws?: any) {
5454
return new HocuspocusProviderWebsocket({
55-
url: "ws://localhost:1234",
55+
url,
5656
WebSocketPolyfill: ws,
5757
});
5858
}

0 commit comments

Comments
 (0)