UNPKG

@eagleeye-solutions/integration-events-common

Version:
71 lines 2.96 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const src_1 = require("../../../src"); const fixtures_1 = require("../../fixtures"); describe('getWalletAccountCreateCampaignEventData', () => { it('returns the data extracted from a WALLET.ACCOUNT.CREATE.CAMPAIGN event with a single ECOUPON', () => { // Arrange const event = src_1.EeAirOutboundEventSchema.parse(fixtures_1.sampleEvents.WALLET_ACCOUNT_CREATE_CAMPAIGN_SINGLE); const expectedOutput = { coupons: [ { accountId: '4083750088', campaignId: '100641679', type: 'ECOUPON', clientType: 'OFFER', state: 'LOADED', status: 'ACTIVE', dateStart: new Date('2025-01-22T20:08:38+00:00'), dateEnd: new Date('2025-12-31T23:59:00+00:00'), }, ], }; // Act const output = (0, src_1.getWalletAccountCreateCampaignEventData)(event); // Assert expect(output).toEqual(expectedOutput); }); it('returns the data extracted from a WALLET.ACCOUNT.CREATE.CAMPAIGN event with multiple ECOUPONs', () => { // Arrange const event = src_1.EeAirOutboundEventSchema.parse(fixtures_1.sampleEvents.WALLET_ACCOUNT_CREATE_CAMPAIGN_MULTIPLE); const expectedOutput = { coupons: [ { accountId: '4083750093', campaignId: '100641542', type: 'ECOUPON', clientType: 'OFFER', state: 'LOADED', status: 'ACTIVE', dateStart: new Date('2025-01-22T20:09:14+00:00'), dateEnd: new Date('2025-12-31T23:59:00+00:00'), }, { accountId: '4083750094', campaignId: '100641543', type: 'ECOUPON', clientType: 'OFFER', state: 'LOADED', status: 'ACTIVE', dateStart: new Date('2025-01-22T20:09:14Z'), dateEnd: new Date('2025-12-31T23:59:00Z'), }, { accountId: '4083750095', campaignId: '100641544', type: 'ECOUPON', clientType: 'OFFER', state: 'LOADED', status: 'ACTIVE', dateStart: new Date('2025-01-22T20:09:14Z'), dateEnd: new Date('2025-12-31T23:59:00Z'), }, ], }; // Act const output = (0, src_1.getWalletAccountCreateCampaignEventData)(event); // Assert expect(output).toEqual(expectedOutput); }); }); //# sourceMappingURL=wallet-account-create-campaign.spec.js.map