mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-12 13:19:40 +00:00
Added deviceId sequelize migration and completed unit tests
This commit is contained in:
parent
423f2d311e
commit
41a288bcdf
10 changed files with 451 additions and 29 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue