mirror of
https://github.com/samuele-cozzi/obsidian-marp-slides.git
synced 2026-07-22 07:40:25 +00:00
fix: unit tests
This commit is contained in:
parent
7b4959adb5
commit
da08b9b122
3 changed files with 18 additions and 17 deletions
|
|
@ -6,7 +6,7 @@
|
|||
[](https://codeclimate.com/github/samuele-cozzi/obsidian-marp-slides/maintainability)
|
||||
[](https://codeclimate.com/github/samuele-cozzi/obsidian-marp-slides/test_coverage)
|
||||
[](https://github.com/samuele-cozzi/obsidian-marp-slides/blob/main/LICENSE)
|
||||

|
||||
<!--  -->
|
||||
|
||||
Marp Slides is very simple & powerful slide deck extension for [Obsidian](href="https://obsidian.md") based on [Marp](https://marp.app/)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export const normalizePath = jest.fn().mockImplementation((str: string) => {
|
|||
|
||||
function normalize (path: string) {
|
||||
if (typeof path !== 'string') {
|
||||
console.log(path);
|
||||
throw new TypeError('expected path to be a string');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ test('file base path', () => {
|
|||
|
||||
const filePath = new FilePath(DEFAULT_SETTINGS);
|
||||
const tests : pathsUtility[] = [
|
||||
{ base: "aaa", relative: "bbb", expected: "aaa/bbb/"}//,
|
||||
//{ base: "C:\\user\\foo\\vault", relative: "\\folder\\file", expected: "C:\\user\\foo\\vault\\folder\\file\\"},
|
||||
{ base: "aaa", relative: "bbb", expected: "app://local/aaa/bbb/"},
|
||||
{ base: "C:\\user\\foo\\vault", relative: "folder\\file", expected: "app://local/C:/user/foo/vault/folder/file/"},
|
||||
];
|
||||
|
||||
tests.forEach(element => {
|
||||
|
|
@ -30,23 +30,23 @@ test('file base path', () => {
|
|||
|
||||
});
|
||||
|
||||
// test('file path', () => {
|
||||
test('file path', () => {
|
||||
|
||||
// const filePath = new FilePath(DEFAULT_SETTINGS);
|
||||
// const tests : pathsUtility[] = [
|
||||
// { base: "aaa", relative: "bbb.md", expected: "aaa/bbb.md"},
|
||||
// { base: "C:\\user\\foo\\vault", relative: "\\folder\\file.md", expected: "C:\\user\\foo\\vault\\folder\\file.md"},
|
||||
// ];
|
||||
const filePath = new FilePath(DEFAULT_SETTINGS);
|
||||
const tests : pathsUtility[] = [
|
||||
{ base: "aaa", relative: "bbb.md", expected: "aaa/bbb.md"},
|
||||
{ base: "C:\\user\\foo\\vault", relative: "folder\\file.md", expected: "C:/user/foo/vault/folder/file.md"},
|
||||
];
|
||||
|
||||
// tests.forEach(element => {
|
||||
// const file = new TFile;
|
||||
tests.forEach(element => {
|
||||
const file = new TFile;
|
||||
|
||||
// file.parent.path = element.relative;
|
||||
// file.vault.adapter.write(element.base, '');
|
||||
file.path = element.relative;
|
||||
file.vault.adapter.write(element.base, '');
|
||||
|
||||
// const result = filePath.getCompleteFilePath(file);
|
||||
const result = filePath.getCompleteFilePath(file);
|
||||
|
||||
// expect(result).toBe(element.expected);
|
||||
// });
|
||||
expect(result).toBe(element.expected);
|
||||
});
|
||||
|
||||
// });
|
||||
});
|
||||
Loading…
Reference in a new issue