aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/sync/push.test.ts
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-25 23:02:35 +0900
committernsfisis <nsfisis@gmail.com>2026-02-25 23:02:35 +0900
commit38b8fc0e9927c4146b4c8b309b2bcc644abd63d0 (patch)
treef76ba23251645e552fccd201362064b06de50bdd /src/client/sync/push.test.ts
parent7a77e72bb49ed3990a0c4581292a37a8a4f35231 (diff)
downloadkioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.tar.gz
kioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.tar.zst
kioku-38b8fc0e9927c4146b4c8b309b2bcc644abd63d0.zip
feat(decks): add default note type setting per deckHEADmain
Allow each deck to specify a default note type that is auto-selected when creating new notes. Includes DB schema migration, server API updates, sync layer support, and UI for editing the default in the deck settings modal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/client/sync/push.test.ts')
-rw-r--r--src/client/sync/push.test.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/client/sync/push.test.ts b/src/client/sync/push.test.ts
index 8605ede..0efc796 100644
--- a/src/client/sync/push.test.ts
+++ b/src/client/sync/push.test.ts
@@ -81,6 +81,7 @@ describe("pendingChangesToPushData", () => {
userId: "user-1",
name: "Test Deck",
description: "A description",
+ defaultNoteTypeId: null,
createdAt: new Date("2024-01-01T10:00:00Z"),
updatedAt: new Date("2024-01-02T15:30:00Z"),
deletedAt: null,
@@ -101,6 +102,7 @@ describe("pendingChangesToPushData", () => {
id: "deck-1",
name: "Test Deck",
description: "A description",
+ defaultNoteTypeId: null,
createdAt: "2024-01-01T10:00:00.000Z",
updatedAt: "2024-01-02T15:30:00.000Z",
deletedAt: null,
@@ -114,6 +116,7 @@ describe("pendingChangesToPushData", () => {
userId: "user-1",
name: "Deleted Deck",
description: null,
+ defaultNoteTypeId: null,
createdAt: new Date("2024-01-01T10:00:00Z"),
updatedAt: new Date("2024-01-03T12:00:00Z"),
deletedAt: new Date("2024-01-03T12:00:00Z"),
@@ -527,6 +530,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
const pushToServer = vi.fn().mockResolvedValue({
@@ -565,6 +569,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
await localDeckRepository.markSynced(deck.id, 1);
@@ -611,6 +616,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
await localDeckRepository.markSynced(deck.id, 1);
@@ -668,6 +674,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
const pushToServer = vi.fn().mockResolvedValue({
@@ -695,6 +702,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
const pushToServer = vi.fn().mockResolvedValue({
@@ -720,6 +728,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
const pushToServer = vi
@@ -739,6 +748,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
const card = await localCardRepository.create({
@@ -884,6 +894,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
await localDeckRepository.markSynced(deck.id, 1);
@@ -931,6 +942,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
await localDeckRepository.markSynced(deck.id, 1);
@@ -994,6 +1006,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
const noteType = await localNoteTypeRepository.create({
@@ -1080,6 +1093,7 @@ describe("PushService", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
});
const pushService = new PushService({
@@ -1102,6 +1116,7 @@ describe("generateCrdtChanges", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
createdAt: new Date("2024-01-01T10:00:00Z"),
updatedAt: new Date("2024-01-02T15:30:00Z"),
deletedAt: null,
@@ -1339,6 +1354,7 @@ describe("generateCrdtChanges", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
createdAt: new Date("2024-01-01T10:00:00Z"),
updatedAt: new Date("2024-01-02T15:30:00Z"),
deletedAt: null,
@@ -1480,6 +1496,7 @@ describe("pendingChangesToPushData with crdtChanges", () => {
userId: "user-1",
name: "Test Deck",
description: null,
+ defaultNoteTypeId: null,
createdAt: new Date("2024-01-01T10:00:00Z"),
updatedAt: new Date("2024-01-02T15:30:00Z"),
deletedAt: null,