test: implement tests

This commit is contained in:
2026-02-05 04:09:47 +05:00
parent 150975faf9
commit 0c3c97914e
10 changed files with 4395 additions and 1957 deletions
+11 -2
View File
@@ -50,7 +50,14 @@ export class PanelStorage {
const panels: Panel[] = JSON.parse(data);
return panels.filter((panel) => this.validatePanel(panel));
// Convert date strings back to Date objects and validate
return panels
.map((panel) => ({
...panel,
createdAt: new Date(panel.createdAt),
updatedAt: new Date(panel.updatedAt),
}))
.filter((panel) => this.validatePanel(panel));
} catch (error) {
logError(error, "Failed to load panels");
return [];
@@ -107,7 +114,9 @@ export class PanelStorage {
typeof panel === "object" &&
typeof panel.id === "string" &&
typeof panel.backgroundImage === "string" &&
Array.isArray(panel.texts) &&
typeof panel.text === "object" &&
typeof panel.text?.id === "string" &&
typeof panel.text?.text === "string" &&
typeof panel.height === "number" &&
panel.height > 0 &&
panel.height <= PANEL_SETTINGS.PANEL_HEIGHT_MAX &&