Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RomaricMourgues committed Feb 24, 2022
1 parent f461300 commit 8717885
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion twake/backend/node/test/client/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const io = require("socket.io-client");

const token =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNjAzODk3MDI3fQ.SLgSEQtsKSgh3k4YEQPmQCVER-_sMkeqrqepMgLT3BE";
const socket = io.connect("http://localhost:3000", { path: "/socket" });
const socket = io("http://localhost:3000", { path: "/socket" });

socket.on("connect", () => {
socket
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "reflect-metadata";
import { describe, expect, it, beforeEach, afterEach } from "@jest/globals";
import { ObjectId } from "mongodb";
import io from "socket.io-client";
import { Channel } from "../../../src/services/channels/entities/channel";
import ChannelServiceAPI from "../../../src/services/channels/provider";
import {
Expand All @@ -11,11 +10,12 @@ import {
import { WorkspaceExecutionContext } from "../../../src/services/channels/types";
import { TestPlatform, init } from "../setup";
import { ChannelUtils, get as getChannelUtils } from "./utils";
import io, { Socket } from "socket.io-client";

describe("The Channels Realtime feature", () => {
const url = "/internal/services/channels/v1";
let platform: TestPlatform;
let socket: SocketIOClient.Socket;
let socket: Socket;
let channelUtils: ChannelUtils;

beforeEach(async () => {
Expand Down Expand Up @@ -46,12 +46,12 @@ describe("The Channels Realtime feature", () => {
afterEach(async () => {
await platform.tearDown();
platform = null;
socket && socket.close();
socket && socket.disconnect();
socket = null;
});

function connect() {
socket = io.connect("http://localhost:3000", { path: "/socket" });
socket = io("http://localhost:3000", { path: "/socket" });
socket.connect();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import "reflect-metadata";
import { describe, expect, it, beforeEach, afterEach } from "@jest/globals";
import io from "socket.io-client";
import { Channel } from "../../../src/services/channels/entities/channel";
import { ChannelMember } from "../../../src/services/channels/entities/channel-member";
import ChannelServiceAPI from "../../../src/services/channels/provider";
import { TestPlatform, init } from "../setup";
import { ChannelUtils, get as getChannelUtils } from "./utils";
import { getPublicRoomName } from "../../../src/services/channels/services/member/realtime";
import { SaveResult } from "../../../src/core/platform/framework/api/crud-service";
import io, { Socket } from "socket.io-client";

describe.skip("The Channels Members Realtime feature", () => {
const url = "/internal/services/channels/v1";
let platform: TestPlatform;
let socket: SocketIOClient.Socket;
let socket: Socket;
let channelUtils: ChannelUtils;
let channelService: ChannelServiceAPI;

Expand All @@ -38,12 +38,12 @@ describe.skip("The Channels Members Realtime feature", () => {
afterEach(async () => {
await platform.tearDown();
platform = null;
socket && socket.close();
socket && socket.disconnect();
socket = null;
});

function connect() {
socket = io.connect("http://localhost:3000", { path: "/socket.io" });
socket = io("http://localhost:3000", { path: "/socket.io" });
socket.connect();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import "reflect-metadata";
import { describe, expect, it, beforeEach, afterEach } from "@jest/globals";
import io from "socket.io-client";
import { TestPlatform, init } from "../setup";
import { MessageServiceAPI } from "../../../src/services/messages/api";
import { TwakePlatform } from "../../../src/core/platform/platform";
import io, { Socket } from "socket.io-client";

describe("The Bookmarks Realtime feature", () => {
const url = "/internal/services/messages/v1";
let platform: TestPlatform;
let socket: SocketIOClient.Socket;
let socket: Socket;

beforeEach(async () => {
platform = await init({
Expand Down Expand Up @@ -41,7 +41,7 @@ describe("The Bookmarks Realtime feature", () => {
});

function connect() {
socket = io.connect("http://localhost:3000", { path: "/socket" });
socket = io("http://localhost:3000", { path: "/socket" });
socket.connect();
}

Expand Down
4 changes: 2 additions & 2 deletions twake/backend/node/test/e2e/setup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function init(
};
}

testPlatform.app.server.close();
testPlatform.app.server.disconnect();

testPlatform.currentUser = { id: uuidv1() };
testPlatform.workspace = {
Expand Down Expand Up @@ -113,7 +113,7 @@ export async function init(

async function tearDown(): Promise<void> {
if (testPlatform) {
testPlatform.app.server.close();
testPlatform.app.server.disconnect();
//await testPlatform.pubsub.stop();
}
}
Expand Down
10 changes: 5 additions & 5 deletions twake/backend/node/test/e2e/websocket/auth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { describe, it, beforeEach, afterEach } from "@jest/globals";
import { TestPlatform, init } from "../setup";
import io from "socket.io-client";
import { UnauthorizedError } from "socketio-jwt";
import { UnauthorizedError } from "@thream/socketio-jwt";
import io, { Socket } from "socket.io-client";

describe("The Websocket authentication", () => {
let platform: TestPlatform;
let socket: SocketIOClient.Socket;
let socket: Socket;

beforeEach(async ends => {
platform = await init({
Expand All @@ -28,15 +28,15 @@ describe("The Websocket authentication", () => {
],
});

socket = io.connect("http://localhost:3000", { path: "/socket" });
socket = io("http://localhost:3000", { path: "/socket" });

ends();
});

afterEach(async ends => {
platform && (await platform.tearDown());
platform = null;
socket && socket.close();
socket && socket.disconnect();
socket = null;
ends();
});
Expand Down
8 changes: 4 additions & 4 deletions twake/backend/node/test/e2e/websocket/realtime.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, it, beforeEach, afterEach, expect } from "@jest/globals";
import { TestPlatform, init } from "../setup";
import io from "socket.io-client";
import io, { Socket } from "socket.io-client";

describe("The Realtime API", () => {
let platform: TestPlatform;
let socket: SocketIOClient.Socket;
let socket: Socket;

beforeEach(async ends => {
platform = await init({
Expand All @@ -26,15 +26,15 @@ describe("The Realtime API", () => {
],
});

socket = io.connect("http://localhost:3000", { path: "/socket" });
socket = io("http://localhost:3000", { path: "/socket" });

ends();
});

afterEach(async ends => {
await platform.tearDown();
platform = null;
socket && socket.close();
socket && socket.disconnect();
socket = null;

ends();
Expand Down

0 comments on commit 8717885

Please sign in to comment.