-
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.
add integration test for vuetify plugin, remove setup scripts from co…
…verage
- Loading branch information
1 parent
d5c20c2
commit e08c515
Showing
6 changed files
with
66 additions
and
3 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
File renamed without changes.
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,41 @@ | ||
import { mount } from "@vue/test-utils"; | ||
import { defineComponent } from "vue"; | ||
import { VBtn } from "vuetify/lib/components/index.mjs"; | ||
import vuetify from "./vuetify"; | ||
|
||
jest.mock("vuetify/styles", () => ({}), { virtual: true }); | ||
jest.mock( | ||
"vuetify/iconsets/mdi-svg", | ||
() => ({ | ||
aliases: [], | ||
mdi: [], | ||
}), | ||
{ virtual: true } | ||
); | ||
|
||
describe("vuetify plugin", () => { | ||
describe("when creating the vuetify plugin", () => { | ||
const setup = () => { | ||
const TestComponent = defineComponent({ | ||
template: "<VBtn></VBtn>", | ||
components: { VBtn }, | ||
}); | ||
|
||
const wrapper = mount(TestComponent, { | ||
global: { plugins: [vuetify] }, | ||
}); | ||
|
||
return { | ||
wrapper, | ||
}; | ||
}; | ||
|
||
it("should make vuetify components available", () => { | ||
const { wrapper } = setup(); | ||
|
||
const button = wrapper.findComponent(VBtn); | ||
|
||
expect(button.exists()).toEqual(true); | ||
}); | ||
}); | ||
}); |
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,20 @@ | ||
import { ComponentMountingOptions, mount } from "@vue/test-utils"; | ||
import { DefineComponent, defineComponent } from "vue"; | ||
|
||
export const mountComposable = <T>( | ||
composable: () => T, | ||
options?: ComponentMountingOptions<DefineComponent> | ||
): T => { | ||
const TestComponent = defineComponent({ | ||
setup() { | ||
const result = composable(); | ||
return { result }; | ||
}, | ||
template: "<div></div>", | ||
}); | ||
|
||
const wrapper = mount(TestComponent, options); | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore | ||
return wrapper.vm.result; | ||
}; |