This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Richard Collier
committed
Sep 29, 2022
1 parent
7c1cb9a
commit 57ae80e
Showing
17 changed files
with
2,032 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { render, fireEvent, within } from "@testing-library/vue"; | ||
import App from "@/App.vue"; | ||
import Toast from "primevue/toast"; | ||
import ProgressSpinner from "primevue/progressspinner"; | ||
import ConfirmDialog from "primevue/confirmdialog"; | ||
import Button from "primevue/button"; | ||
import Menu from "primevue/menu"; | ||
import TopBar from "im-library"; | ||
import {beforeEach, describe, it, vi, expect} from 'vitest'; | ||
import PrimeVue from "primevue/config"; | ||
|
||
vi.mock("vuex", () => ({ | ||
useStore: () => ({ | ||
dispatch: mockDispatch | ||
}) | ||
})); | ||
|
||
const mockDispatch = vi.fn(); | ||
|
||
const mockPush = vi.fn(); | ||
const mockGo = vi.fn(); | ||
const mockRoute = { name: "Concept" }; | ||
|
||
vi.mock("vue-router", () => ({ | ||
useRouter: () => ({ | ||
push: mockPush, | ||
go: mockGo | ||
}), | ||
useRoute: () => mockRoute | ||
})); | ||
|
||
const mockAdd = vi.fn(); | ||
|
||
vi.mock("primevue/usetoast", () => ({ | ||
useToast: () => ({ | ||
add: mockAdd | ||
}) | ||
})); | ||
|
||
describe("App.vue", () => { | ||
let component; | ||
|
||
beforeEach(async () => { | ||
vi.resetAllMocks(); | ||
component = render(App, { | ||
global: { | ||
components: { Toast, ProgressSpinner, ConfirmDialog, TopBar, Button, Menu }, | ||
stubs: { "router-link": true, "router-view": true, ReleaseNotes: true, Search: true }, | ||
plugins: [PrimeVue] | ||
} | ||
}); | ||
}); | ||
|
||
it("should check auth and update store history count on mount", async () => { | ||
expect(mockDispatch).toHaveBeenCalledTimes(1); | ||
expect(mockDispatch).toHaveBeenCalledWith("authenticateCurrentUser"); | ||
}); | ||
}); |
Oops, something went wrong.