Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial attempt to fix title > 255 char #1189

Merged
merged 13 commits into from
Jan 5, 2024
44 changes: 42 additions & 2 deletions server/tests/unit/api/room.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _ from "lodash";
import _, { before } from "lodash";
import { QueueMode, Visibility } from "../../../../common/models/types";
Victor-M-Giraldo marked this conversation as resolved.
Show resolved Hide resolved
import request from "supertest";
import tokens from "../../../../server/auth/tokens";
Expand Down Expand Up @@ -228,7 +228,8 @@ describe("Room API", () => {
[
{ arg: "title", reason: "not allowed (too long, must be at most 255 characters)" },
{
name: "abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab",
name: "foo",
title: "abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab",
isTemporary: true,
},
],
Expand Down Expand Up @@ -316,4 +317,43 @@ describe("Room API", () => {
});
}
});

describe("POST /api/room/:name", () => {
let getSessionInfoSpy: jest.SpyInstance;
let validateSpy: jest.SpyInstance;
beforeAll(async () => {
getSessionInfoSpy = jest.spyOn(tokens, "getSessionInfo").mockResolvedValue({
isLoggedIn: false,
username: "test",
});
validateSpy = jest.spyOn(tokens, "validate").mockResolvedValue(true);
});

afterAll(() => {
getSessionInfoSpy.mockRestore();
validateSpy.mockRestore();
});

afterEach(async () => {
try {
await roommanager.unloadAllRooms();
} catch (e) {
if (!(e instanceof RoomNotFoundException)) {
throw e;
}
}
await UserModel.destroy({ where: {} });
});

it.each([
[
{ arg: "title", reason: "not allowed (too long, must be at most 255 characters)" },
{
name: "foo",
title: "abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab",
isTemporary: true,
},
],
]);
});
});
Loading