Add more tests to TopBar component
This commit is contained in:
parent
d66459bea9
commit
411966f727
@ -1,16 +1,35 @@
|
|||||||
/* eslint-disable no-undef */
|
/* eslint-disable no-undef */
|
||||||
import { shallowMount } from "@vue/test-utils";
|
import { shallowMount } from "@vue/test-utils";
|
||||||
import TopBar from "../TopBar.vue";
|
import TopBar from "../TopBar.vue";
|
||||||
import { createApp } from "vue";
|
import { useEtherStore } from "../../../store/ether";
|
||||||
import App from "../../../App.vue";
|
|
||||||
import { createPinia } from "pinia";
|
|
||||||
|
|
||||||
const app = createApp(App);
|
import { createPinia, setActivePinia } from "pinia";
|
||||||
app.use(createPinia());
|
|
||||||
|
|
||||||
describe("TopBar.vue", () => {
|
describe("TopBar.vue", () => {
|
||||||
it("render component when called", () => {
|
beforeEach(() => {
|
||||||
|
setActivePinia(createPinia());
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should render connect wallet button", () => {
|
||||||
const wrapper = shallowMount(TopBar);
|
const wrapper = shallowMount(TopBar);
|
||||||
// expect(wrapper).toBeCalled();
|
expect(wrapper.html()).toContain("Conectar carteira");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should render button to change to seller view when in buyer screen", () => {
|
||||||
|
const wrapper = shallowMount(TopBar);
|
||||||
|
expect(wrapper.html()).toContain("Quero vender");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should render button to change to seller view when in buyer screen", () => {
|
||||||
|
const etherStore = useEtherStore();
|
||||||
|
etherStore.setSellerView(true);
|
||||||
|
const wrapper = shallowMount(TopBar);
|
||||||
|
expect(wrapper.html()).toContain("Quero comprar");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should render the P2Pix logo correctly", () => {
|
||||||
|
const wrapper = shallowMount(TopBar);
|
||||||
|
const img = wrapper.findAll(".logo");
|
||||||
|
expect(img.length).toBe(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user