From bf05cf4f73722b40e23787da7abfc9dcd72603f2 Mon Sep 17 00:00:00 2001 From: Shane Brunson Date: Fri, 7 Jun 2024 14:11:04 -0500 Subject: [PATCH] remove logging test (#211) --- src/tracking.test.js | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/src/tracking.test.js b/src/tracking.test.js index 133aa12d..e5b3b63a 100644 --- a/src/tracking.test.js +++ b/src/tracking.test.js @@ -1,5 +1,5 @@ /* @flow */ -/* eslint-disable promise/no-native, no-restricted-globals, compat/compat */ + import { describe, it, vi, expect } from "vitest"; import { makeMockScriptElement } from "../test/helpers"; @@ -9,17 +9,12 @@ import { getSDKInitTime, setupLogger } from "./tracking"; const clientId = "foobar123"; const mockScriptSrc = `https://test.paypal.com/sdk/js?client-id=${clientId}`; -let metricCounterSpy; -let windowReadyPromiseResolver; vi.mock("./logger", async () => { const actual = await vi.importActual("./logger"); return { ...actual, getLogger: vi.fn(() => { const logger = actual.getLogger(); - metricCounterSpy = vi - .spyOn(logger, "metricCounter") - .mockImplementation(() => {}); // eslint-disable-line no-empty-function return logger; }), }; @@ -32,11 +27,6 @@ vi.mock("@krakenjs/belter/src", async () => { getCurrentScript: vi.fn(() => { return makeMockScriptElement(mockScriptSrc); }), - waitForWindowReady: vi.fn(() => { - return new Promise((resolve) => { - windowReadyPromiseResolver = resolve; - }); - }), }; }); @@ -50,25 +40,4 @@ describe(`tracking cases`, () => { setupLogger(); expect(getSDKInitTime()).toEqual(expect.any(Number)); }); - - it("setupLogger should setup logger with IEIntranet enabled", () => { - window.document.documentMode = true; - setupLogger(); - }); - - it("should call metric counter on window load", async () => { - windowReadyPromiseResolver(); - await new Promise((resolve) => setTimeout(resolve)); // Flush promises - - expect(metricCounterSpy).toHaveBeenCalledWith( - expect.objectContaining({ - namespace: "sdk_client.init.count", - dimensions: expect.objectContaining({ - isPayPalDomain: "false", - }), - }) - ); - }); }); - -/* eslint-enable promise/no-native, no-restricted-globals, compat/compat */