Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit acc7a4d

Browse files
committed
divaguing
1 parent 8e66ac4 commit acc7a4d

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

jest.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
module.exports = {
22
preset: "ts-jest",
33
testEnvironment: "jsdom",
4+
rootDir: ".",
5+
roots: [
6+
"<rootDir>",
7+
"<rootDir>/src/",
8+
"<rootDir>/node_modules/"
9+
],
10+
modulePaths: [
11+
"<rootDir>",
12+
"<rootDir>/src",
13+
"<rootDir>/node_modules"
14+
],
415
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
516
moduleDirectories: ["node_modules", "src"],
617
};

package.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"eslint": "8.13.0",
3737
"jest": "27.5.1",
3838
"obsidian": "0.14.6",
39-
"obsidian-dataview": "0.5.13",
39+
"obsidian-dataview": "0.5.16",
4040
"rollup": "2.70.2",
4141
"ts-jest": "27.1.4",
4242
"tslib": "2.3.1",
@@ -58,5 +58,24 @@
5858
"react-table": "7.7.0",
5959
"react-window": "1.8.6",
6060
"regenerator-runtime": "0.13.9"
61-
}
61+
},
62+
"jest": {
63+
"moduleNameMapper": {
64+
"src/(.*)": "<rootDir>/src/$1"
65+
},
66+
"transform": {
67+
"^.+\\.svelte$": [
68+
"svelte-jester",
69+
{
70+
"preprocess": true
71+
}
72+
],
73+
"^.+\\.ts$": "ts-jest"
74+
},
75+
"moduleFileExtensions": [
76+
"js",
77+
"ts",
78+
"svelte"
79+
]
80+
}
6281
}

src/__tests__/reactTable.test.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import { render, screen } from "@testing-library/react";
2-
import { Vault } from 'obsidian';
2+
import obsidian from 'obsidian';
33
import { Database } from 'components/index/Database';
44
import {TableDataType} from 'cdm/FolderModel';
55
import { makeData } from "mock/mockUtils";
66
import React from "react";
77

8-
jest.mock("obsidian");
9-
const VaultMock = Vault as jest.MockedClass<typeof Vault>;
8+
// jest.mock("obsidian");
9+
1010
test("Render without crashing", () => {
1111
const mockedTableData:TableDataType = makeData(10);
1212
render(<Database {...mockedTableData} />);
1313
const titleLabel = screen.getByText(" title");
1414
expect(titleLabel).toBeInTheDocument();
15-
});
15+
});
16+

0 commit comments

Comments
 (0)