UNPKG

@eagleeye-solutions/integration-events-common

Version:
57 lines 1.91 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const src_1 = require("../../../src"); const fixtures_1 = require("../../fixtures"); const logger = { debug: jest.fn(), info: jest.fn(), error: jest.fn(), }; const mockAirClient = { getWalletTransactionById: jest.fn(), }; jest.mock('../../../src/common/ee-air-client/ee-air-client', () => { return { EeAirClient: jest.fn().mockImplementation(() => mockAirClient), }; }); describe('getPosConnectWalletSpendVoidEventData', () => { it('returns Coupon Redeemed events and an Order Completed event', async () => { // Arrange const event = src_1.EeAirOutboundEventSchema.parse(fixtures_1.sampleEvents.SPEND_POSCONNECT_WALLET_SPEND_VOID); const connectorConfig = { credentials: { clientId: 'some-client-id', secret: 'some-secret', }, configuration: { currency: 'USD', }, domains: {}, }; mockAirClient.getWalletTransactionById.mockResolvedValue({ reference: 'MockedOriginalTransactionReference', }); const expectedOutput = { points: { pointsBalance: 56340, }, tier: 0, transaction: { pointsSpent: 0, pointsBalance: 56340, transactionReference: 'SpendTransactionReferenceFeb26b', originalTransactionReference: 'MockedOriginalTransactionReference', }, voided: true, }; // Act const output = await (0, src_1.getPosConnectWalletSpendVoidEventData)(event, { connectorConfig, logger, }); // Assert expect(output).toEqual(expectedOutput); }); }); //# sourceMappingURL=posconnect-wallet-spend-void.spec.js.map