Fix test cases and improve test from custom modal
This commit is contained in:
parent
03c7d14b4b
commit
3346b96f18
27
src/components/CustomModal/__tests__/CustomModal.spec.ts
Normal file
27
src/components/CustomModal/__tests__/CustomModal.spec.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { mount } from "@vue/test-utils";
|
||||||
|
import CustomModal from "../CustomModal.vue";
|
||||||
|
|
||||||
|
describe("CustomModal test", () => {
|
||||||
|
test("Test custom modal when receive is redirect modal props as false", () => {
|
||||||
|
const wrapper = mount(CustomModal, {
|
||||||
|
props: {
|
||||||
|
isRedirectModal: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.html()).toContain("ATENÇÃO!");
|
||||||
|
expect(wrapper.html()).toContain("Entendi");
|
||||||
|
});
|
||||||
|
|
||||||
|
test("Test custom modal when receive is redirect modal props as true", () => {
|
||||||
|
const wrapper = mount(CustomModal, {
|
||||||
|
props: {
|
||||||
|
isRedirectModal: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(wrapper.html()).toContain("Retomar a última compra?");
|
||||||
|
expect(wrapper.html()).toContain("Não");
|
||||||
|
expect(wrapper.html()).toContain("Sim");
|
||||||
|
});
|
||||||
|
});
|
@ -1,10 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { pix } from "../utils/QrCodePix";
|
import { pix } from "@/utils/QrCodePix";
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { debounce } from "@/utils/debounce";
|
import { debounce } from "@/utils/debounce";
|
||||||
import CustomButton from "./CustomButton/CustomButton.vue";
|
import CustomButton from "@/components/CustomButton/CustomButton.vue";
|
||||||
import CustomModal from "./CustomModal.vue";
|
import CustomModal from "@/components//CustomModal/CustomModal.vue";
|
||||||
import api from "../services/index";
|
import api from "@/services/index";
|
||||||
|
|
||||||
// props and store references
|
// props and store references
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -2,16 +2,15 @@
|
|||||||
import SearchComponent from "@/components/SearchComponent.vue";
|
import SearchComponent from "@/components/SearchComponent.vue";
|
||||||
import LoadingComponent from "@/components/LoadingComponent/LoadingComponent.vue";
|
import LoadingComponent from "@/components/LoadingComponent/LoadingComponent.vue";
|
||||||
import BuyConfirmedComponent from "@/components/BuyConfirmedComponent/BuyConfirmedComponent.vue";
|
import BuyConfirmedComponent from "@/components/BuyConfirmedComponent/BuyConfirmedComponent.vue";
|
||||||
import { ref, onMounted, watch } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
import { useEtherStore } from "@/store/ether";
|
import { useEtherStore } from "@/store/ether";
|
||||||
import QrCodeComponent from "@/components/QrCodeComponent.vue";
|
import QrCodeComponent from "@/components/QrCodeComponent.vue";
|
||||||
import CustomModal from "@/components/CustomModal.vue";
|
import CustomModal from "@/components/CustomModal/CustomModal.vue";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
import { addLock, releaseLock } from "@/blockchain/buyerMethods";
|
import { addLock, releaseLock } from "@/blockchain/buyerMethods";
|
||||||
import {
|
import {
|
||||||
updateWalletStatus,
|
updateWalletStatus,
|
||||||
listReleaseTransactionByWalletAddress,
|
listReleaseTransactionByWalletAddress,
|
||||||
checkUnreleasedLocks,
|
|
||||||
} from "@/blockchain/wallet";
|
} from "@/blockchain/wallet";
|
||||||
import { getNetworksLiquidity } from "@/blockchain/events";
|
import { getNetworksLiquidity } from "@/blockchain/events";
|
||||||
import type { Event } from "ethers";
|
import type { Event } from "ethers";
|
||||||
@ -27,7 +26,7 @@ const etherStore = useEtherStore();
|
|||||||
etherStore.setSellerView(false);
|
etherStore.setSellerView(false);
|
||||||
|
|
||||||
// States
|
// States
|
||||||
const { loadingLock, walletAddress, networkName } = storeToRefs(etherStore);
|
const { loadingLock, walletAddress } = storeToRefs(etherStore);
|
||||||
const flowStep = ref<Step>(Step.Search);
|
const flowStep = ref<Step>(Step.Search);
|
||||||
const pixTarget = ref<number>();
|
const pixTarget = ref<number>();
|
||||||
const tokenAmount = ref<number>();
|
const tokenAmount = ref<number>();
|
||||||
@ -87,18 +86,18 @@ const releaseTransaction = async (e2eId: string) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkForUnreleasedLocks = async () => {
|
// const checkForUnreleasedLocks = async () => {
|
||||||
const walletLocks = await checkUnreleasedLocks(walletAddress.value);
|
// const walletLocks = await checkUnreleasedLocks(walletAddress.value);
|
||||||
if (walletLocks) {
|
// if (walletLocks) {
|
||||||
lockID.value = walletLocks.lockID;
|
// lockID.value = walletLocks.lockID;
|
||||||
tokenAmount.value = walletLocks.pix.value;
|
// tokenAmount.value = walletLocks.pix.value;
|
||||||
pixTarget.value = Number(walletLocks.pix.pixKey);
|
// pixTarget.value = Number(walletLocks.pix.pixKey);
|
||||||
showModal.value = true;
|
// showModal.value = true;
|
||||||
} else {
|
// } else {
|
||||||
flowStep.value = Step.Search;
|
// flowStep.value = Step.Search;
|
||||||
showModal.value = false;
|
// showModal.value = false;
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
// if (walletAddress) {
|
// if (walletAddress) {
|
||||||
// await checkForUnreleasedLocks();
|
// await checkForUnreleasedLocks();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user