Create tests to BuyConfirmedComponent

This commit is contained in:
enzoggqs 2023-01-16 01:35:03 -03:00
parent 411966f727
commit 2c78a203b0
3 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,31 @@
import { mount } from "@vue/test-utils";
import BuyConfirmedComponent from "../BuyConfirmedComponent.vue";
describe("BuyConfirmedComponent.vue", () => {
const wrapper = mount(BuyConfirmedComponent, {
props: {
lastWalletReleaseTransactions: [],
tokenAmount: 1,
},
});
test("Test component Header Text", () => {
expect(wrapper.html()).toContain("Os tokens já foram transferidos");
expect(wrapper.html()).toContain("para a sua carteira!");
});
test("Test component Container Text", () => {
expect(wrapper.html()).toContain("Tokens recebidos");
expect(wrapper.html()).toContain("BRZ");
expect(wrapper.html()).toContain("Não encontrou os tokens?");
expect(wrapper.html()).toContain("Clique no botão abaixo para");
expect(wrapper.html()).toContain("cadastrar o BRZ em sua carteira.");
});
test("Test makeAnotherTransactionEmit", async () => {
wrapper.vm.$emit("makeAnotherTransaction");
await wrapper.vm.$nextTick();
expect(wrapper.emitted("makeAnotherTransaction")).toBeTruthy();
});
});

View File

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import SearchComponent from "../components/SearchComponent.vue"; import SearchComponent from "../components/SearchComponent.vue";
import ValidationComponent from "../components/LoadingComponent.vue"; import ValidationComponent from "../components/LoadingComponent.vue";
import BuyConfirmedComponent from "@/components/BuyConfirmedComponent.vue"; import BuyConfirmedComponent from "@/components/BuyConfirmedComponent/BuyConfirmedComponent.vue";
import blockchain from "../utils/blockchain"; import blockchain from "../utils/blockchain";
import { ref } from "vue"; import { ref } from "vue";