From b8d4782a216684dad10d728d33940464d110d6d8 Mon Sep 17 00:00:00 2001 From: Chirag Date: Fri, 8 Nov 2024 22:41:14 +0530 Subject: [PATCH] Refactor PortalDataMapper: add customAbi, update simulateAttest, remove attestV2 --- sdk/src/dataMapper/PortalDataMapper.test.ts | 12 +- sdk/src/dataMapper/PortalDataMapper.ts | 190 ++++++-------------- 2 files changed, 70 insertions(+), 132 deletions(-) diff --git a/sdk/src/dataMapper/PortalDataMapper.test.ts b/sdk/src/dataMapper/PortalDataMapper.test.ts index d97d6fb2..d3539669 100644 --- a/sdk/src/dataMapper/PortalDataMapper.test.ts +++ b/sdk/src/dataMapper/PortalDataMapper.test.ts @@ -20,11 +20,21 @@ describe("PortalDataMapper", () => { attestationRegistryAddress: "0x4", }; const mockWeb3Client = {} as PublicClient; - const mockVeraxSdk = {} as VeraxSdk; const mockWalletClient = {} as WalletClient; + const mockVeraxSdk = { + schema: { + findOneById: jest.fn(), + }, + } as unknown as VeraxSdk; beforeEach(() => { portalDataMapper = new PortalDataMapper(mockConf, mockWeb3Client, mockVeraxSdk, mockWalletClient); + + // Setup a default mock return value for findOneById + (mockVeraxSdk.schema.findOneById as jest.Mock).mockResolvedValue({ + id: "123", + name: "Sample Schema", + }); }); afterEach(() => { diff --git a/sdk/src/dataMapper/PortalDataMapper.ts b/sdk/src/dataMapper/PortalDataMapper.ts index 3af7a5e2..62ee378d 100644 --- a/sdk/src/dataMapper/PortalDataMapper.ts +++ b/sdk/src/dataMapper/PortalDataMapper.ts @@ -27,6 +27,7 @@ export default class PortalDataMapper extends BaseDataMapper