feat: add column count and is public options to board creation modal (#930)

* feat: add column count and is public options to board creation modal

* test: adjust board creation test to match modified schema
This commit is contained in:
Meier Lukas
2024-08-09 18:28:52 +02:00
committed by GitHub
parent 349c49462f
commit fcb72e6716
6 changed files with 36 additions and 11 deletions

View File

@@ -102,6 +102,8 @@ export const boardRouter = createTRPCRouter({
await transaction.insert(boards).values({
id: boardId,
name: input.name,
isPublic: input.isPublic,
columnCount: input.columnCount,
creatorId: ctx.session.user.id,
});
await transaction.insert(sections).values({

View File

@@ -294,12 +294,14 @@ describe("createBoard should create a new board", () => {
});
// Act
await caller.createBoard({ name: "newBoard" });
await caller.createBoard({ name: "newBoard", columnCount: 24, isPublic: true });
// Assert
const dbBoard = await db.query.boards.findFirst();
expect(dbBoard).toBeDefined();
expect(dbBoard?.name).toBe("newBoard");
expect(dbBoard?.columnCount).toBe(24);
expect(dbBoard?.isPublic).toBe(true);
expect(dbBoard?.creatorId).toBe(defaultCreatorId);
const dbSection = await db.query.sections.findFirst();
@@ -314,7 +316,7 @@ describe("createBoard should create a new board", () => {
const caller = boardRouter.createCaller({ db, session: defaultSession });
// Act
const actAsync = async () => await caller.createBoard({ name: "newBoard" });
const actAsync = async () => await caller.createBoard({ name: "newBoard", columnCount: 12, isPublic: true });
// Assert
await expect(actAsync()).rejects.toThrowError("Permission denied");