From fe6ac3825f28b0e5125dececa3d96558357eab68 Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Thu, 7 Nov 2024 19:13:46 +0100 Subject: [PATCH] fmt --- .../src/lib/services/public/sns.services.ts | 2 +- .../lib/services/public/sns.services.spec.ts | 29 +++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/frontend/src/lib/services/public/sns.services.ts b/frontend/src/lib/services/public/sns.services.ts index 4aa7d6a209..2241e3b701 100644 --- a/frontend/src/lib/services/public/sns.services.ts +++ b/frontend/src/lib/services/public/sns.services.ts @@ -1,4 +1,3 @@ -import { SnsSwapLifecycle } from "@dfinity/sns"; import { snsAggregatorApiService } from "$lib/api-services/sns-aggregator.api-service"; import { queryProposals } from "$lib/api/proposals.api"; import { buildAndStoreWrapper } from "$lib/api/sns-wrapper.api"; @@ -11,6 +10,7 @@ import { isLastCall } from "$lib/utils/env.utils"; import { toToastError } from "$lib/utils/error.utils"; import { ProposalStatus, Topic, type ProposalInfo } from "@dfinity/nns"; import { Principal } from "@dfinity/principal"; +import { SnsSwapLifecycle } from "@dfinity/sns"; import { getCurrentIdentity } from "../auth.services"; export const loadSnsProjects = async (): Promise => { diff --git a/frontend/src/tests/lib/services/public/sns.services.spec.ts b/frontend/src/tests/lib/services/public/sns.services.spec.ts index 0118a6944b..3cdf3e0331 100644 --- a/frontend/src/tests/lib/services/public/sns.services.spec.ts +++ b/frontend/src/tests/lib/services/public/sns.services.spec.ts @@ -1,8 +1,11 @@ -import { SnsSwapLifecycle } from "@dfinity/sns"; import { clearSnsAggregatorCache } from "$lib/api-services/sns-aggregator.api-service"; import * as agent from "$lib/api/agent.api"; import * as aggregatorApi from "$lib/api/sns-aggregator.api"; -import { clearWrapperCache, wrapper, wrappers as getWrappers} from "$lib/api/sns-wrapper.api"; +import { + clearWrapperCache, + wrappers as getWrappers, + wrapper, +} from "$lib/api/sns-wrapper.api"; import { snsFunctionsStore } from "$lib/derived/sns-functions.derived"; import { snsTotalTokenSupplyStore } from "$lib/derived/sns-total-token-supply.derived"; import { loadSnsProjects } from "$lib/services/public/sns.services"; @@ -27,6 +30,7 @@ import { } from "$tests/mocks/sns.api.mock"; import { blockAllCallsTo } from "$tests/utils/module.test-utils"; import type { HttpAgent } from "@dfinity/agent"; +import { SnsSwapLifecycle } from "@dfinity/sns"; import { get } from "svelte/store"; import { mock } from "vitest-mock-extended"; @@ -169,19 +173,19 @@ describe("SNS public services", () => { it("should build and store wrappers, only for non-aborted SNSes", async () => { const committedSns1 = aggregatorSnsMockWith({ rootCanisterId: principal(0).toText(), - lifecycle: SnsSwapLifecycle.Committed + lifecycle: SnsSwapLifecycle.Committed, }); const committedSns2 = aggregatorSnsMockWith({ rootCanisterId: principal(1).toText(), - lifecycle: SnsSwapLifecycle.Committed + lifecycle: SnsSwapLifecycle.Committed, }); const abortedSns1 = aggregatorSnsMockWith({ rootCanisterId: principal(2).toText(), - lifecycle: SnsSwapLifecycle.Aborted + lifecycle: SnsSwapLifecycle.Aborted, }); const abortedSns2 = aggregatorSnsMockWith({ rootCanisterId: principal(3).toText(), - lifecycle: SnsSwapLifecycle.Aborted + lifecycle: SnsSwapLifecycle.Aborted, }); vi.spyOn(aggregatorApi, "querySnsProjects").mockResolvedValue([ @@ -193,10 +197,17 @@ describe("SNS public services", () => { await loadSnsProjects(); - const wrappers = await getWrappers({identity: mockIdentity, certified: true}); + const wrappers = await getWrappers({ + identity: mockIdentity, + certified: true, + }); expect(wrappers).toHaveLength(2); - expect(wrappers.has(committedSns1.canister_ids.root_canister_id)).toBe(true); - expect(wrappers.has(committedSns2.canister_ids.root_canister_id)).toBe(true); + expect(wrappers.has(committedSns1.canister_ids.root_canister_id)).toBe( + true + ); + expect(wrappers.has(committedSns2.canister_ids.root_canister_id)).toBe( + true + ); }); }); });