From 587e0558e90dfaca571f1df2ba1759d84f041b02 Mon Sep 17 00:00:00 2001 From: Shibo Lyu Date: Sun, 29 Dec 2024 22:43:36 +0800 Subject: [PATCH] fix: 0.3.1 --- deno.json | 2 +- logic/board.ts | 8 ++++---- tests/board.test.ts | 4 ++-- tests/checkFullBoard.ts | 5 +++++ 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/deno.json b/deno.json index 14c2394..95d1901 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@textplace/core", - "version": "0.3.0", + "version": "0.3.1", "exports": "./mod.ts", "imports": { "@deno/dnt": "jsr:@deno/dnt@^0.41.3" diff --git a/logic/board.ts b/logic/board.ts index 9dcb312..0436cdc 100644 --- a/logic/board.ts +++ b/logic/board.ts @@ -106,9 +106,9 @@ export function renderFullBoard(data: BoardData): FullBoard { return { w: lineLength, h: totalLineCount, - ch: ([] as string[]).concat(...chLines).flat(), - color: ([] as string[]).concat(...colorLines).flat(), - bg_color: ([] as string[]).concat(...bgColorLines).flat(), - width: ([] as number[]).concat(...widthLines).flat(), + ch: chLines.flat(), + color: colorLines.flat(), + bg_color: bgColorLines.flat(), + width: widthLines.flat(), }; } diff --git a/tests/board.test.ts b/tests/board.test.ts index 7e15725..886a2f4 100644 --- a/tests/board.test.ts +++ b/tests/board.test.ts @@ -119,7 +119,7 @@ Deno.test("board", async (t) => { await t.step("on-demand creation: only changed sections are saved", () => { assert(board); - assertEquals(board.sections.length, 2); - assertEquals(board.sections[0].length, 2); + assertEquals(board.sections[2], undefined); + assertEquals(board.sections[0][2], undefined); }); }); diff --git a/tests/checkFullBoard.ts b/tests/checkFullBoard.ts index 9984249..9484c40 100644 --- a/tests/checkFullBoard.ts +++ b/tests/checkFullBoard.ts @@ -47,6 +47,11 @@ export function checkFullBoard(board: FullBoard) { console.error("width: ", widthLine); }; + if (typeof cCh !== "string") { + printSituation(); + throw new Error("cCh is not string"); + } + if (!isValidColor(cCo) || !isValidColor(cBg)) { printSituation(); throw new Error("cCo or cBg is not valid");