From 3848191002d40164d9d969bfffeec96e2dfd9fe1 Mon Sep 17 00:00:00 2001 From: Yusef Habib Fernandez Date: Thu, 5 Dec 2024 10:29:05 +0100 Subject: [PATCH] simplify signin check --- .../components/header/ExportIcpTransactionsButton.svelte | 3 +-- .../header/ExportIcpTransactionsButton.spec.ts | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/src/lib/components/header/ExportIcpTransactionsButton.svelte b/frontend/src/lib/components/header/ExportIcpTransactionsButton.svelte index 8da1efa1d28..7c35db80313 100644 --- a/frontend/src/lib/components/header/ExportIcpTransactionsButton.svelte +++ b/frontend/src/lib/components/header/ExportIcpTransactionsButton.svelte @@ -131,13 +131,12 @@ const exportIcpTransactions = async () => { // Button will only be shown if logged in - if (!(identity instanceof SignIdentity)) return; try { const nnsAccounts = Object.values($nnsAccountsListStore).flat(); const data = await getAccountTransactionsConcurrently({ accounts: nnsAccounts, - identity, + identity: identity as SignIdentity, }); const datasets = buildDatasets(data); const fileName = `icp_transactions_export_${formatDateCompact(new Date())}`; diff --git a/frontend/src/tests/lib/components/header/ExportIcpTransactionsButton.spec.ts b/frontend/src/tests/lib/components/header/ExportIcpTransactionsButton.spec.ts index 3f868532add..bd0f9324883 100644 --- a/frontend/src/tests/lib/components/header/ExportIcpTransactionsButton.spec.ts +++ b/frontend/src/tests/lib/components/header/ExportIcpTransactionsButton.spec.ts @@ -3,10 +3,12 @@ import ExportIcpTransactionsButton from "$lib/components/header/ExportIcpTransac import { authStore } from "$lib/stores/auth.store"; import * as toastsStore from "$lib/stores/toasts.store"; import * as exportToCsv from "$lib/utils/export-to-csv.utils"; -import { mockPrincipal, setNoIdentity } from "$tests/mocks/auth.store.mock"; +import { + mockSignInIdentity, + setNoIdentity, +} from "$tests/mocks/auth.store.mock"; import { mockAccountsStoreData } from "$tests/mocks/icp-accounts.store.mock"; import { createTransactionWithId } from "$tests/mocks/icp-transactions.mock"; -import { MockLedgerIdentity } from "$tests/mocks/ledger.identity.mock"; import { ExportIcpTransactionsButtonPo } from "$tests/page-objects/ExportIcpTransactionsButton.page-object"; import { JestPageObjectElement } from "$tests/page-objects/jest.page-object"; import { setAccountsForTesting } from "$tests/utils/accounts.test-utils"; @@ -32,9 +34,6 @@ describe("ExportIcpTransactionsButton", () => { vi.useFakeTimers(); vi.setSystemTime(mockDate); - const mockSignInIdentity = new MockLedgerIdentity({ - principal: mockPrincipal, - }); authStore.setForTesting(mockSignInIdentity); setAccountsForTesting({