-
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '25-fr-inline-field-supported'
- Loading branch information
Showing
28 changed files
with
403 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
module.exports = { | ||
verbose: true, | ||
preset: 'ts-jest', | ||
testEnvironment: 'jsdom', | ||
moduleDirectories: ["node_modules", "src"], | ||
transform: { | ||
'^.+\\.ts$': 'ts-jest', | ||
}, | ||
moduleFileExtensions: ['js', 'ts'], | ||
testEnvironment: 'jsdom', | ||
moduleFileExtensions: ['js', 'ts', 'tsx'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { obtainMetadataColumns, obtainColumnsFromFolder } from "components/Columns"; | ||
import { MetadataColumns } from "helpers/Constants"; | ||
import { generateYamlColumns } from "mock/mockTableUtils"; | ||
describe("Columns", () => { | ||
/** Metadata columns */ | ||
test('obtainMetadataColumns()', async () => { | ||
// Check if mandatory columns exists | ||
const columnsRecord = await obtainMetadataColumns(generateYamlColumns(5)); | ||
expect(columnsRecord).toHaveProperty(MetadataColumns.FILE); | ||
expect(columnsRecord).toHaveProperty(MetadataColumns.ADD_COLUMN); | ||
}); | ||
/** Table columns */ | ||
test('obtainColumnsFromFolder()', async () => { | ||
const columnsRecord = await obtainMetadataColumns(generateYamlColumns(5)); | ||
const tableColumns = await obtainColumnsFromFolder(columnsRecord); | ||
expect(tableColumns.length >= 5).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { MockProxy, mock, mockDeep, DeepMockProxy } from 'jest-mock-extended'; | ||
import { labTest1 } from 'mock/labTest'; | ||
import { App, TFile } from 'obsidian'; | ||
test('test', () => { | ||
// const tfileArrayMock: MockProxy<TFile[]> = mock<TFile[]>(); | ||
// tfileArrayMock | ||
// // @ts-ignore | ||
// const mockObj: DeepMockProxy<App> = mockDeep<App>(); | ||
// global.app = mockObj; | ||
// mockObj.vault.getFiles.mockReturnValue(fakeGetFilesResponse); | ||
// expect(labTest1()).toEqual(fakeGetFilesResponse); | ||
}); | ||
|
||
const fakeGetFilesResponse: TFile[] = [ | ||
{ | ||
"name": "file1", | ||
"path": "path1", | ||
"parent": { | ||
"name": "folder1", | ||
"children": [ | ||
{ | ||
"name": "file2", | ||
"path": "path2", | ||
"vault": null, | ||
"parent": null, | ||
}, | ||
], | ||
"isRoot": () => true, | ||
"vault": null, | ||
"path": "path1", | ||
"parent": null | ||
}, | ||
"basename": "file1", | ||
"vault": null, | ||
"extension": "", | ||
"stat": null | ||
}, | ||
{ | ||
"name": "file2", | ||
"path": "path2", | ||
"parent": { | ||
"name": "folder1", | ||
"children": [ | ||
{ | ||
"name": "file2", | ||
"path": "path2", | ||
"vault": null, | ||
"parent": null, | ||
}, | ||
], | ||
"isRoot": () => true, | ||
"vault": null, | ||
"path": "path1", | ||
"parent": null | ||
}, | ||
"basename": "file2", | ||
"vault": null, | ||
"extension": "", | ||
"stat": null | ||
}, | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,44 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import obsidian from "obsidian"; | ||
import { Database } from "components/index/Database"; | ||
import { TableDataType } from "cdm/FolderModel"; | ||
import { makeData } from "mock/mockUtils"; | ||
import { makeData } from "mock/mockTableUtils"; | ||
import React from "react"; | ||
import { | ||
DeepMockProxy, | ||
mockDeep, | ||
mock, | ||
MockProxy, | ||
mockReset, | ||
} from "jest-mock-extended"; | ||
import { App } from "obsidian"; | ||
import StateManager from "StateManager"; | ||
|
||
// jest.mock("obsidian"); | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
describe("React-table", () => { | ||
// @ts-ignore | ||
const mockGlobalApp: DeepMockProxy<App> = mockDeep<App>(); | ||
/** | ||
* Run this before each test. | ||
*/ | ||
beforeAll(() => { | ||
mockReset(mockGlobalApp); | ||
global.app = mockGlobalApp; | ||
}); | ||
|
||
test("Render without crashing", () => { | ||
// const mockedTableData: TableDataType = makeData(10); | ||
// render(<Database {...mockedTableData} />); | ||
// const titleLabel = screen.getByText(" title"); | ||
// expect(titleLabel).toBeInTheDocument(); | ||
test("Render without crashing", async () => { | ||
const mockedTableData: TableDataType = await makeData(10); | ||
//mockedTableData.stateManager = StateManager(); | ||
render(<Database {...mockedTableData} />); | ||
const titleLabel = screen.getByText(" title"); | ||
expect(titleLabel).toBeInTheDocument(); | ||
}); | ||
|
||
/** | ||
* Run this after each test. | ||
*/ | ||
afterAll(() => { | ||
global.app = undefined; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.