api-client/components/history/__tests__/RestCard.sample

57 lines
1.4 KiB
Text
Raw Normal View History

import { mount } from "@vue/test-utils"
2021-05-17 13:47:57 +00:00
import RestCard from "../rest/Card"
const factory = (props) => {
return mount(RestCard, {
propsData: props,
mocks: {
$t: (text) => text,
},
directives: {
tooltip() {
/* stub */
},
closePopover() {
/* stub */
},
},
})
}
const url = "https://dummydata.com/get"
const entry = {
type: "rest",
2021-05-17 13:47:57 +00:00
url,
method: "GET",
status: 200,
star: false,
}
describe("RestCard", () => {
test("Mounts properly if props are given", () => {
const wrapper = factory({ entry })
expect(wrapper).toBeTruthy()
})
2021-07-09 07:39:52 +00:00
// test("toggle-star emitted on clicking on star button", async () => {
// const wrapper = factory({ entry })
// await wrapper.find("button[data-testid='star_button']").trigger("click")
// expect(wrapper.emitted("toggle-star")).toBeTruthy()
// })
2021-07-09 07:39:52 +00:00
// test("use-entry emit on clicking the restore button", async () => {
// const wrapper = factory({ entry })
// await wrapper
// .find("button[data-testid='restore_history_entry']")
// .trigger("click")
// expect(wrapper.emitted("use-entry")).toBeTruthy()
// })
2021-07-09 07:39:52 +00:00
// test("delete-entry emit on clicking the delete button", async () => {
// const wrapper = factory({ entry })
// await wrapper
// .find("button[data-testid=delete_history_entry]")
// .trigger("click")
// expect(wrapper.emitted("delete-entry")).toBeTruthy()
// })
})