Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix unit tests

Stanimir3579907e25d9
diff --git a/tests/unit/paths.test.js b/tests/unit/paths.test.js
index 635b9df13..d0b184532 100644
--- a/tests/unit/paths.test.js
+++ b/tests/unit/paths.test.js
@@ -6,6 +6,7 @@ const {
extractFileExtension,
getMetaDirectoryPath,
getMetaFileLocationForFile,
+ getMetaFileLocationForDir,
} = require('@tagspaces/tagspaces-common/paths');
const dirSeparatorUnix = '/';
@@ -53,14 +54,20 @@ function executeTests(dirPath, fileName, fileExtension, dirSeparator) {
});
test(platform + ' getMetaFileLocationForFile ' + filepath, () => {
- expect(getMetaFileLocationForFile(filepath, dirSeparator)).toBe(
+ const isDir = filepath.endsWith(dirSeparator);
+ const metaFilePath = isDir
+ ? getMetaFileLocationForDir(filepath, dirSeparator)
+ : getMetaFileLocationForFile(filepath, dirSeparator);
+ expect(metaFilePath).toBe(
dirPath +
dirSeparator +
AppConfig.metaFolder +
dirSeparator +
- fileName +
- (fileExtension ? '.' + fileExtension : '') +
- AppConfig.metaFileExt,
+ (isDir
+ ? AppConfig.metaFolderFile
+ : fileName +
+ (fileExtension ? '.' + fileExtension : '') +
+ AppConfig.metaFileExt),
);
});
}