fix test and build ci to deploy app correctly

This commit is contained in:
RcleydsonR 2023-02-13 12:58:57 -03:00
parent c27dde4dfe
commit 5972f24f4e
4 changed files with 16 additions and 34 deletions

View File

@ -56,6 +56,7 @@ const emit = defineEmits(["makeAnotherTransaction"]);
</div> </div>
<div class="w-full max-w-4xl lg-view"> <div class="w-full max-w-4xl lg-view">
<ListingComponent <ListingComponent
:deposit-list="[]"
:walletTransactions="lastWalletReleaseTransactions" :walletTransactions="lastWalletReleaseTransactions"
:isManageMode="false" :isManageMode="false"
> >

View File

@ -150,7 +150,7 @@ showInitialItems();
v-for="item in itemsToShow" v-for="item in itemsToShow"
:key="item.blockNumber" :key="item.blockNumber"
> >
<div class="flex justify-between items-center"> <div class="item-container">
<div> <div>
<p class="text-sm leading-5 font-medium text-gray-600"> <p class="text-sm leading-5 font-medium text-gray-600">
{{ getEventName((item as Event).event) }} {{ getEventName((item as Event).event) }}
@ -238,6 +238,10 @@ p {
@apply flex flex-col items-center justify-center gap-4; @apply flex flex-col items-center justify-center gap-4;
} }
.item-container {
@apply flex justify-between items-center;
}
.text { .text {
@apply text-white text-center; @apply text-white text-center;
} }

View File

@ -13,6 +13,7 @@ describe("ListingComponent.vue", () => {
test("Test Message when an empty array is received", () => { test("Test Message when an empty array is received", () => {
const wrapper = mount(ListingComponent, { const wrapper = mount(ListingComponent, {
props: { props: {
depositList: [],
walletTransactions: [], walletTransactions: [],
isManageMode: true, isManageMode: true,
}, },
@ -21,42 +22,16 @@ describe("ListingComponent.vue", () => {
expect(wrapper.html()).toContain("Não há nenhuma transação anterior"); expect(wrapper.html()).toContain("Não há nenhuma transação anterior");
}); });
test("Test Headers on List in Manage Mode", () => {
const wrapper = mount(ListingComponent, {
props: {
walletTransactions: MockValidDeposits,
isManageMode: true,
},
});
expect(wrapper.html()).toContain("Valor");
expect(wrapper.html()).toContain("Data");
expect(wrapper.html()).toContain("Retirar tokens");
});
test("Test Headers on List in Unmanage Mode", () => {
const wrapper = mount(ListingComponent, {
props: {
walletTransactions: MockEvents,
isManageMode: false,
},
});
expect(wrapper.html()).toContain("Valor");
expect(wrapper.html()).toContain("Data");
expect(wrapper.html()).toContain("Tipo de transação");
expect(wrapper.html()).toContain("Checar transação");
});
test("Test number of elements in the list first render", () => { test("Test number of elements in the list first render", () => {
const wrapper = mount(ListingComponent, { const wrapper = mount(ListingComponent, {
props: { props: {
depositList: [],
walletTransactions: MockEvents, walletTransactions: MockEvents,
isManageMode: false, isManageMode: false,
}, },
}); });
const elements = wrapper.findAll(".transaction-date"); const elements = wrapper.findAll(".item-container");
expect(elements).toHaveLength(3); expect(elements).toHaveLength(3);
}); });
@ -64,18 +39,19 @@ describe("ListingComponent.vue", () => {
test("Test load more button behavior", async () => { test("Test load more button behavior", async () => {
const wrapper = mount(ListingComponent, { const wrapper = mount(ListingComponent, {
props: { props: {
depositList: [],
walletTransactions: MockValidDeposits, walletTransactions: MockValidDeposits,
isManageMode: false, isManageMode: false,
}, },
}); });
const btn = wrapper.find("button"); const btn = wrapper.find("button");
let elements = wrapper.findAll(".transaction-date"); let elements = wrapper.findAll(".item-container");
expect(elements).toHaveLength(3); expect(elements).toHaveLength(3);
await btn.trigger("click"); await btn.trigger("click");
elements = wrapper.findAll(".transaction-date"); elements = wrapper.findAll(".item-container");
expect(elements).toHaveLength(5); expect(elements).toHaveLength(5);
}); });
@ -83,14 +59,15 @@ describe("ListingComponent.vue", () => {
test("Test withdraw offer button emit", async () => { test("Test withdraw offer button emit", async () => {
const wrapper = mount(ListingComponent, { const wrapper = mount(ListingComponent, {
props: { props: {
depositList: MockValidDeposits,
walletTransactions: MockValidDeposits, walletTransactions: MockValidDeposits,
isManageMode: true, isManageMode: true,
}, },
}); });
wrapper.vm.$emit("withdrawDeposit"); wrapper.vm.$emit("depositWithdrawn");
await wrapper.vm.$nextTick(); await wrapper.vm.$nextTick();
expect(wrapper.emitted("withdrawDeposit")).toBeTruthy(); expect(wrapper.emitted("depositWithdrawn")).toBeTruthy();
}); });
}); });

View File

@ -30,6 +30,6 @@ describe("TopBar.vue", () => {
it("should render the P2Pix logo correctly", () => { it("should render the P2Pix logo correctly", () => {
const wrapper = shallowMount(TopBar); const wrapper = shallowMount(TopBar);
const img = wrapper.findAll(".logo"); const img = wrapper.findAll(".logo");
expect(img.length).toBe(1); expect(img.length).toBe(2);
}); });
}); });