Added deviceId sequelize migration and completed unit tests

This commit is contained in:
Jason Axley 2025-08-24 15:56:43 -07:00
parent 423f2d311e
commit 41a288bcdf
10 changed files with 451 additions and 29 deletions

View file

@ -86,12 +86,12 @@ function buildBookLibraryItemParams(libraryFile, bookId, libraryId, libraryFolde
}
exports.buildBookLibraryItemParams = buildBookLibraryItemParams
function stubFileUtils() {
function stubFileUtils(mockFileInfo = getMockFileInfo()) {
let getInoStub, getDeviceIdStub, getFileTimestampsWithInoStub
getInoStub = sinon.stub(fileUtils, 'getIno')
getInoStub.callsFake((path) => {
const normalizedPath = fileUtils.filePathToPOSIX(path).replace(/\/$/, '')
const stats = getMockFileInfo().get(normalizedPath)
const stats = mockFileInfo.get(normalizedPath)
if (stats) {
return stats.ino
} else {
@ -102,7 +102,7 @@ function stubFileUtils() {
getDeviceIdStub = sinon.stub(fileUtils, 'getDeviceId')
getDeviceIdStub.callsFake(async (path) => {
const normalizedPath = fileUtils.filePathToPOSIX(path).replace(/\/$/, '')
const stats = getMockFileInfo().get(normalizedPath)
const stats = mockFileInfo.get(normalizedPath)
if (stats) {
return stats.dev
} else {
@ -113,7 +113,7 @@ function stubFileUtils() {
getFileTimestampsWithInoStub = sinon.stub(fileUtils, 'getFileTimestampsWithIno')
getFileTimestampsWithInoStub.callsFake(async (path) => {
const normalizedPath = fileUtils.filePathToPOSIX(path).replace(/\/$/, '')
const stats = getMockFileInfo().get(normalizedPath)
const stats = mockFileInfo.get(normalizedPath)
if (stats) {
return stats
} else {