-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(iterable): component test refactor (#3250)
- Loading branch information
1 parent
bac3cc5
commit 650ea9c
Showing
7 changed files
with
1,900 additions
and
3,782 deletions.
There are no files selected for viewing
97 changes: 97 additions & 0 deletions
97
test/integrations/destinations/iterable/processor/aliasTestData.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
]; |
Oops, something went wrong.