Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

00602 Transaction wrongly shows a parent transaction property #630

Merged
merged 2 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/transaction/TransactionGroupAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class TransactionGroupAnalyzer {
break
}
}
return result
return this.childTransactions.value.length ? result : null
})

public readonly childTransactions = computed(() => {
Expand Down
11 changes: 6 additions & 5 deletions src/pages/TransactionDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
</div>
<div v-else class="h-has-pill has-background-danger mr-3 h-is-text-size-2 mt-3">FAILURE</div>
</div>
<span v-if="routeToAllTransactions && isLargeScreen" id="allTransactionsLink" class="is-inline-block mt-2">
<router-link :to="routeToAllTransactions">
<span class="h-is-property-text has-text-grey">Show all transactions with the same ID</span>
</router-link>
</span>
</div>
<span v-if="routeToAllTransactions && !isLargeScreen">
<router-link :to="routeToAllTransactions">
Expand All @@ -50,6 +45,12 @@
</span>
</template>

<template v-slot:control>
<router-link v-if="routeToAllTransactions && isLargeScreen" id="allTransactionsLink" :to="routeToAllTransactions">
<span class="h-is-property-text has-text-grey">Show all transactions with the same ID</span>
</router-link>
</template>

<template v-slot:content>
<NotificationBanner v-if="notification" :message="notification"/>
</template>
Expand Down
37 changes: 37 additions & 0 deletions tests/unit/transaction/TransactionDetails.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
SAMPLE_NETWORK_EXCHANGERATE,
SAMPLE_NETWORK_NODES,
SAMPLE_PARENT_CHILD_TRANSACTIONS,
SAMPLE_SAME_ID_NOT_PARENT_TRANSACTIONS,
SAMPLE_SCHEDULING_SCHEDULED_TRANSACTIONS,
SAMPLE_SYSTEM_CONTRACT_CALL_TRANSACTIONS,
SAMPLE_TOKEN,
Expand Down Expand Up @@ -657,6 +658,42 @@ describe("TransactionDetails.vue", () => {
await flushPromises()
});

it("Should NOT display a link to the parent transaction", async () => {

await router.push("/") // To avoid "missing required param 'network'" error

const NONCE_1 = SAMPLE_SAME_ID_NOT_PARENT_TRANSACTIONS.transactions[1]
const matcher1 = "/api/v1/transactions"
mock.onGet(matcher1).reply((config: AxiosRequestConfig) => {
if (config.params.timestamp == NONCE_1.consensus_timestamp) {
return [200, {transactions: [NONCE_1]}]
} else {
return [404]
}
});
const matcher11 = "/api/v1/transactions/" + NONCE_1.transaction_id
mock.onGet(matcher11).reply(200, SAMPLE_SAME_ID_NOT_PARENT_TRANSACTIONS);

const wrapper = mount(TransactionDetails, {
global: {
plugins: [router, Oruga]
},
props: {
transactionLoc: NONCE_1.consensus_timestamp,
},
});

await flushPromises()
// console.log(wrapper.html())
// console.log(wrapper.text())

expect(wrapper.text()).toMatch(RegExp("^Transaction " + normalizeTransactionId(NONCE_1.transaction_id, true)))
expect(wrapper.find("#parentTransaction").exists()).toBe(false)

wrapper.unmount()
await flushPromises()
});

it("Should display transaction details with account/token association", async () => {

await router.push("/") // To avoid "missing required param 'network'" error
Expand Down