Skip to content

Commit

Permalink
feat(iterable): component test refactor (#3250)
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 authored Apr 24, 2024
1 parent bac3cc5 commit 650ea9c
Show file tree
Hide file tree
Showing 7 changed files with 1,900 additions and 3,782 deletions.
97 changes: 97 additions & 0 deletions test/integrations/destinations/iterable/processor/aliasTestData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { generateMetadata, transformResultBuilder } from './../../../testUtils';
import { Destination } from '../../../../../src/types';
import { ProcessorTestData } from '../../../testTypes';

const destination: Destination = {
ID: '123',
Name: 'iterable',
DestinationDefinition: {
ID: '123',
Name: 'iterable',
DisplayName: 'Iterable',
Config: {},
},
WorkspaceID: '123',
Transformations: [],
Config: {
apiKey: 'testApiKey',
preferUserId: false,
trackAllPages: true,
trackNamedPages: false,
mapToSingleEvent: false,
trackCategorisedPages: false,
},
Enabled: true,
};

const headers = {
api_key: 'testApiKey',
'Content-Type': 'application/json',
};

const properties = {
path: '/abc',
referrer: '',
search: '',
title: '',
url: '',
category: 'test-category',
};

const sentAt = '2020-08-28T16:26:16.473Z';
const originalTimestamp = '2020-08-28T16:26:06.468Z';

export const aliasTestData: ProcessorTestData[] = [
{
id: 'iterable-alias-test-1',
name: 'iterable',
description: 'Alias call with userId and previousId',
scenario: 'Business',
successCriteria:
'Response should contain status code 200 and it should contain update email payload',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
destination,
message: {
anonymousId: 'anonId',
userId: '[email protected]',
previousId: '[email protected]',
name: 'ApplicationLoaded',
context: {},
properties,
type: 'alias',
sentAt,
originalTimestamp,
},
metadata: generateMetadata(1),
},
],
},
},
output: {
response: {
status: 200,
body: [
{
output: transformResultBuilder({
userId: '',
headers,
endpoint: 'https://api.iterable.com/api/users/updateEmail',
JSON: {
currentEmail: '[email protected]',
newEmail: '[email protected]',
},
}),
statusCode: 200,
metadata: generateMetadata(1),
},
],
},
},
},
];
Loading

0 comments on commit 650ea9c

Please sign in to comment.