-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 48-component-page and fix tests
- Loading branch information
Showing
16 changed files
with
118 additions
and
335 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
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
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,64 +1,34 @@ | ||
import FileTree from "@/components/FileTree.vue"; | ||
import DashboardView from "@/views/DashboardView.vue"; | ||
import { VueWrapper } from "@vue/test-utils"; | ||
import { describe, expect, it, vi } from "vitest"; | ||
import { useRoute } from "vue-router"; | ||
import { createFetchResponse, mockedFetch, mountSuspense } from "../test.utils"; | ||
|
||
vi.mock("vue-router", () => ({ | ||
useRoute: vi.fn(), | ||
useRouter: vi.fn(() => ({ | ||
push: () => {}, | ||
})), | ||
})); | ||
import DashboardView from "@/views/DashboardView.vue"; | ||
|
||
describe("DashboardView", () => { | ||
it("Parse the list of fetched list of mander to an array of FileTreeNode.", async () => { | ||
const paths = [ | ||
"probabl-ai/demo-usecase/training/0", | ||
"probabl-ai/test-mandr/0", | ||
"probabl-ai/test-mandr/1", | ||
"probabl-ai/test-mandr/2", | ||
"probabl-ai/test-mandr/3", | ||
"probabl-ai/test-mandr/4", | ||
]; | ||
import FileTree from "@/components/FileTree.vue"; | ||
import { beforeEach } from "node:test"; | ||
import { mountSuspense } from "../test.utils"; | ||
|
||
mockedFetch.mockResolvedValue(createFetchResponse(paths)); | ||
beforeEach(() => { | ||
vi.mock("vue-router", () => ({ | ||
useRoute: vi.fn(), | ||
useRouter: vi.fn(() => ({ | ||
push: () => {}, | ||
})), | ||
})); | ||
}); | ||
|
||
describe("DashboardView", () => { | ||
it("Renders properly", async () => { | ||
(useRoute as any).mockImplementationOnce(() => ({ | ||
params: { | ||
segments: ["a", "b"], | ||
}, | ||
})); | ||
|
||
const wrapper = await mountSuspense(DashboardView); | ||
const fileTree = wrapper.getComponent(FileTree); | ||
expect(fileTree.props()).toEqual({ | ||
nodes: [ | ||
{ | ||
uri: "probabl-ai", | ||
children: [ | ||
{ | ||
uri: "probabl-ai/demo-usecase", | ||
children: [ | ||
{ | ||
uri: "probabl-ai/demo-usecase/training", | ||
children: [{ uri: "probabl-ai/demo-usecase/training/0" }], | ||
}, | ||
], | ||
}, | ||
{ | ||
uri: "probabl-ai/test-mandr", | ||
children: [ | ||
{ uri: "probabl-ai/test-mandr/0" }, | ||
{ uri: "probabl-ai/test-mandr/1" }, | ||
{ uri: "probabl-ai/test-mandr/2" }, | ||
{ uri: "probabl-ai/test-mandr/3" }, | ||
{ uri: "probabl-ai/test-mandr/4" }, | ||
], | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
const dashboard = await mountSuspense(DashboardView); | ||
expect(dashboard).toBeInstanceOf(VueWrapper); | ||
|
||
const fileTree = await dashboard.findComponent(FileTree); | ||
expect(fileTree).toBeInstanceOf(VueWrapper); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.