diff --git a/apps/extension/src/background/approvals/service.test.ts b/apps/extension/src/background/approvals/service.test.ts index 727b918d7..9ba1f989f 100644 --- a/apps/extension/src/background/approvals/service.test.ts +++ b/apps/extension/src/background/approvals/service.test.ts @@ -263,13 +263,12 @@ describe("approvals service", () => { it("should approve connection if it's not already approved", async () => { const interfaceOrigin = "origin"; const tabId = 1; - const chainId = "chain-id"; jest.spyOn(service, "isConnectionApproved").mockResolvedValue(false); jest.spyOn(service as any, "launchApprovalPopup"); service["resolverMap"] = {}; - const promise = service.approveConnection(interfaceOrigin, chainId); + const promise = service.approveConnection(interfaceOrigin); await new Promise((r) => setTimeout(() => { r(); @@ -283,18 +282,17 @@ describe("approvals service", () => { ); expect(service.isConnectionApproved).toHaveBeenCalledWith( interfaceOrigin, - chainId + undefined ); await expect(promise).resolves.toBeDefined(); }); it("should not approve connection if it was already approved", async () => { const interfaceOrigin = "origin"; - const chainId = "chain-id"; jest.spyOn(service, "isConnectionApproved").mockResolvedValue(true); await expect( - service.approveConnection(interfaceOrigin, chainId) + service.approveConnection(interfaceOrigin) ).resolves.toBeUndefined(); }); }); @@ -355,14 +353,13 @@ describe("approvals service", () => { describe("approveDisconnection", () => { it("should approve disconnection if there is a connection already approved", async () => { const interfaceOrigin = "origin"; - const chainId = "chain-id"; const tabId = 1; jest.spyOn(service, "isConnectionApproved").mockResolvedValue(true); jest.spyOn(service as any, "launchApprovalPopup"); service["resolverMap"] = {}; - const promise = service.approveDisconnection(interfaceOrigin, chainId); + const promise = service.approveDisconnection(interfaceOrigin); await new Promise((r) => setTimeout(() => { r(); @@ -376,18 +373,17 @@ describe("approvals service", () => { ); expect(service.isConnectionApproved).toHaveBeenCalledWith( interfaceOrigin, - chainId + undefined ); await expect(promise).resolves.toBeDefined(); }); it("should not approve disconnection if it is NOT already approved", async () => { const interfaceOrigin = "origin"; - const chainId = "chain-id"; jest.spyOn(service, "isConnectionApproved").mockResolvedValue(false); await expect( - service.approveDisconnection(interfaceOrigin, chainId) + service.approveDisconnection(interfaceOrigin) ).resolves.toBeUndefined(); }); }); @@ -547,36 +543,27 @@ describe("approvals service", () => { describe("isConnectionApproved", () => { it("should return true if origin is approved", async () => { const origin = "origin"; - const chainId = "chain-id"; jest .spyOn(localStorage, "getApprovedOrigins") .mockResolvedValue([origin]); - await expect(service.isConnectionApproved(origin, chainId)).resolves.toBe( - true - ); + await expect(service.isConnectionApproved(origin)).resolves.toBe(true); }); it("should return false if origin is not approved", async () => { const origin = "origin"; - const chainId = "chain-id"; jest.spyOn(localStorage, "getApprovedOrigins").mockResolvedValue([]); - await expect(service.isConnectionApproved(origin, chainId)).resolves.toBe( - false - ); + await expect(service.isConnectionApproved(origin)).resolves.toBe(false); }); it("should return false if there are no origins in store", async () => { const origin = "origin"; - const chainId = "chain-id"; jest .spyOn(localStorage, "getApprovedOrigins") .mockResolvedValue(undefined); - await expect(service.isConnectionApproved(origin, chainId)).resolves.toBe( - false - ); + await expect(service.isConnectionApproved(origin)).resolves.toBe(false); }); }); });