Files
lnreader/__mocks__/database.js
T
Patrick Loser eafa545b2a Use novel refactor (#1838)
* init

* feat: add zustand dependency and persistence key contract

* refactor: extract bootstrap data loading into reusable service

* refactor: move chapter mutations into store-ready action helpers

* feat: add zustand novel store with cache and core actions

* refactor: bridge novel persistence contracts for migration safety

* refactor: migrate NovelScreen domain flows to zustand selectors

* refactor: migrate NovelScreenList to selector-based store access

* refactor: move reader chapter flows onto store boundaries

* refactor: decouple useNovelSettings from broad context domain state

* refactor: align migrateNovel with stable persistence contracts

* refactor: cut novel-reader consumers to store-only context boundary

* refactor: retire legacy useNovel and route cache cleanup export

* test: update suites for store-only context boundary cutover

* test: modernize store-era mocks and add contract coverage

* test: finalize Task-15 sweep—remove dead useNovelData and lint clear mocksContract

Final validation confirms mock-contract test suite clean and target file deletion verified with zero stale references in src/ scope.

* remove imports from NovelScreen

* reworked ai output

* improvements

* implemented synchronus novel and chapter fetch

* refactor tests

* fix db tests

* Update remaining tests.

* Harden chapter actions and bootstrap flows

* Only count filtered chapters

* improved chapter insert speed by optimizing triggers

* Improved the batching function

* Added drizzle support to dbManager.batch

* removed better-sqlite3 for testing

* fix tests

* Update updateNovelChapters fucntion

* reverse read filter

* fix snackbar

* fixed page bottomsheet

* resolved paged novels showing wrong chapter number on opening

* use openPage instead of setPageIndex in chapterDrawer

* fix lint & tests

* fix type issues

* fix various smaller issues

* updated novel restore

* Delete tsconfig.tsbuildinfo
2026-05-06 16:55:55 +02:00

70 lines
2.0 KiB
JavaScript

jest.mock('@database/queries/NovelQueries', () => ({
getNovelById: jest.fn(),
getNovelByPath: jest.fn(),
deleteCachedNovels: jest.fn(),
getCachedNovels: jest.fn(),
insertNovelAndChapters: jest.fn(),
}));
jest.mock('@database/queries/CategoryQueries', () => ({
getCategoriesFromDb: jest.fn(),
getCategoriesWithCount: jest.fn(),
createCategory: jest.fn(),
deleteCategoryById: jest.fn(),
updateCategory: jest.fn(),
isCategoryNameDuplicate: jest.fn(),
updateCategoryOrderInDb: jest.fn(),
getAllNovelCategories: jest.fn(),
_restoreCategory: jest.fn(),
}));
jest.mock('@database/queries/ChapterQueries', () => ({
bookmarkChapter: jest.fn(),
markChapterRead: jest.fn(),
markChaptersRead: jest.fn(),
markPreviuschaptersRead: jest.fn(),
markPreviousChaptersUnread: jest.fn(),
markChaptersUnread: jest.fn(),
deleteChapter: jest.fn(),
deleteChapters: jest.fn(),
getPageChapters: jest.fn(),
insertChapters: jest.fn(),
getCustomPages: jest.fn(),
getChapterCount: jest.fn(),
getChapterCountSync: jest.fn(),
getPageChaptersBatched: jest.fn(),
getNovelChaptersSync: jest.fn(),
getFirstUnreadChapter: jest.fn(),
updateChapterProgress: jest.fn(),
}));
jest.mock('@database/queries/HistoryQueries', () => ({
getHistoryFromDb: jest.fn(),
insertHistory: jest.fn(),
deleteChapterHistory: jest.fn(),
deleteAllHistory: jest.fn(),
}));
jest.mock('@database/queries/LibraryQueries', () => ({
getLibraryNovelsFromDb: jest.fn(),
getLibraryWithCategory: jest.fn(),
}));
jest.mock('@database/queries/RepositoryQueries', () => ({
getRepositoriesFromDb: jest.fn(),
isRepoUrlDuplicated: jest.fn(),
createRepository: jest.fn(),
deleteRepositoryById: jest.fn(),
updateRepository: jest.fn(),
}));
jest.mock('@database/queries/StatsQueries', () => ({
getLibraryStatsFromDb: jest.fn(),
getChaptersTotalCountFromDb: jest.fn(),
getChaptersReadCountFromDb: jest.fn(),
getChaptersUnreadCountFromDb: jest.fn(),
getChaptersDownloadedCountFromDb: jest.fn(),
getNovelGenresFromDb: jest.fn(),
getNovelStatusFromDb: jest.fn(),
}));