diff --git a/src/ui/components/ArchivedCredentials/ArchivedCredentials.test.tsx b/src/ui/components/ArchivedCredentials/ArchivedCredentials.test.tsx index fe27ec504..6f55197b5 100644 --- a/src/ui/components/ArchivedCredentials/ArchivedCredentials.test.tsx +++ b/src/ui/components/ArchivedCredentials/ArchivedCredentials.test.tsx @@ -15,6 +15,7 @@ import { ArchivedCredentialsContainer } from "./ArchivedCredentials"; const deleteCredentialsMock = jest.fn((id: string) => Promise.resolve(true)); const deleteNotificationMock = jest.fn(() => Promise.resolve(true)); +const markCredentialPendingDeleteMock = jest.fn((id: string) => Promise.resolve(true)); jest.mock("../../../core/agent/agent", () => ({ Agent: { @@ -24,6 +25,7 @@ jest.mock("../../../core/agent/agent", () => ({ deleteCredential: (id: string) => deleteCredentialsMock(id), getCredentials: jest.fn().mockResolvedValue([]), archiveCredential: jest.fn(), + markCredentialPendingDelete: (id: string) => markCredentialPendingDeleteMock(id), }, keriaNotifications: { deleteNotificationRecordById: () => deleteNotificationMock(), @@ -254,7 +256,7 @@ describe("Archived and revoked credentials", () => { await passcodeFiller(getByText, getByTestId, "1", 6); await waitFor(() => { - expect(deleteCredentialsMock).toBeCalled(); + expect(markCredentialPendingDeleteMock).toBeCalled(); }); }); }); @@ -351,7 +353,7 @@ describe("Archived and revoked credentials", () => { await passcodeFiller(getByText, getByTestId, "1", 6); await waitFor(() => { - expect(deleteCredentialsMock).toBeCalled(); + expect(markCredentialPendingDeleteMock).toBeCalled(); expect(deleteNotificationMock).toBeCalled(); }); }); diff --git a/src/ui/components/CredentialDetailModule/CredentialDetailModule.test.tsx b/src/ui/components/CredentialDetailModule/CredentialDetailModule.test.tsx index 21d3618d9..381991877 100644 --- a/src/ui/components/CredentialDetailModule/CredentialDetailModule.test.tsx +++ b/src/ui/components/CredentialDetailModule/CredentialDetailModule.test.tsx @@ -23,7 +23,7 @@ const path = TabsRoutePath.CREDENTIALS + "/" + credsFixAcdc[0].id; const archiveCredential = jest.fn(); const deleteCredential = jest.fn(); const deleteNotificationRecordById = jest.fn(); - +const markCredentialPendingDelete = jest.fn(); jest.mock("../../../core/agent/agent", () => ({ Agent: { agent: { @@ -34,6 +34,7 @@ jest.mock("../../../core/agent/agent", () => ({ getCredentials: jest.fn(() => Promise.resolve(true)), archiveCredential: () => archiveCredential(), deleteCredential: () => deleteCredential(), + markCredentialPendingDelete:() => markCredentialPendingDelete(), }, connections: { getConnectionShortDetailById: jest.fn(() => Promise.resolve([])), @@ -657,7 +658,7 @@ describe("Cred Detail Module - archived", () => { passcodeFiller(getByText, getByTestId, "1", 6); await waitFor(() => { - expect(deleteCredential).toBeCalled(); + expect(markCredentialPendingDelete).toBeCalled(); }); fireEvent.click(getByTestId("alert-delete-archive-cancel-button")); @@ -864,7 +865,7 @@ describe("Cred detail - revoked", () => { await waitFor(() => { expect(archiveCredential).toBeCalled(); - expect(deleteCredential).toBeCalled(); + expect(markCredentialPendingDelete).toBeCalled(); expect(deleteNotificationRecordById).toBeCalled(); }); }); diff --git a/src/ui/pages/Credentials/Credentials.test.tsx b/src/ui/pages/Credentials/Credentials.test.tsx index 144037848..6e238ac17 100644 --- a/src/ui/pages/Credentials/Credentials.test.tsx +++ b/src/ui/pages/Credentials/Credentials.test.tsx @@ -26,7 +26,7 @@ import { CredentialsFilters } from "./Credentials.types"; const deleteIdentifierMock = jest.fn(); const archiveIdentifierMock = jest.fn(); - +const markCredentialPendingDeleteMock = jest.fn(); jest.mock("../../../core/agent/agent", () => ({ Agent: { agent: { @@ -34,7 +34,8 @@ jest.mock("../../../core/agent/agent", () => ({ getCredentialDetailsById: jest.fn(), deleteCredential: () => deleteIdentifierMock(), archiveCredential: () => archiveIdentifierMock(), - getCredentials: jest.fn() + getCredentials: jest.fn(), + markCredentialPendingDelete: () => markCredentialPendingDeleteMock() }, basicStorage: { findById: jest.fn(), @@ -540,7 +541,7 @@ describe("Creds Tab", () => { await passcodeFiller(getByText, getByTestId, "1", 6); await waitFor(() => { - expect(deleteIdentifierMock).toBeCalled(); + expect(markCredentialPendingDeleteMock).toBeCalled(); expect(archiveIdentifierMock).toBeCalled(); }); });