You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
51 lines
1.2 KiB
import { createLocalVue, mount } from "@vue/test-utils";
|
|
import Vuex from "vuex";
|
|
import VueRouter from "vue-router";
|
|
|
|
import Comment from "../../src/components/Comment.vue";
|
|
import DateFilter from "../../src/common/date.filter";
|
|
|
|
const localVue = createLocalVue();
|
|
localVue.filter("date", DateFilter);
|
|
localVue.use(Vuex);
|
|
localVue.use(VueRouter);
|
|
|
|
describe("Comment", () => {
|
|
it("should render correct contents", () => {
|
|
const router = new VueRouter({
|
|
routes: [
|
|
{
|
|
name: "profile",
|
|
path: "/profile",
|
|
component: null
|
|
}
|
|
]
|
|
});
|
|
let store = new Vuex.Store({
|
|
getters: {
|
|
currentUser: () => ({
|
|
username: "user-3518518"
|
|
})
|
|
}
|
|
});
|
|
|
|
const wrapper = mount(Comment, {
|
|
localVue,
|
|
store,
|
|
router,
|
|
propsData: {
|
|
slug: "super-cool-comment-slug-1245781274",
|
|
comment: {
|
|
body: "body of comment",
|
|
author: {
|
|
image: "https://vuejs.org/images/logo.png",
|
|
username: "user-3518518"
|
|
},
|
|
createdAt: "",
|
|
id: 1245781274
|
|
}
|
|
}
|
|
});
|
|
expect(wrapper.isVueInstance()).toBeTruthy();
|
|
});
|
|
});
|