1
- import {
2
- generateMetadata ,
3
- overrideDestination ,
4
- transformResultBuilder ,
5
- } from './../../../testUtils' ;
6
- import { Destination } from '../../../../../src/types' ;
7
1
import { ProcessorTestData } from '../../../testTypes' ;
2
+ import { Destination , Metadata } from '../../../../../src/types' ;
3
+ import { overrideDestination } from '../../../testUtils' ;
4
+
5
+ const baseMetadata : Metadata = {
6
+ sourceId : 'default-sourceId' ,
7
+ workspaceId : 'default-workspaceId' ,
8
+ namespace : 'default-namespace' ,
9
+ instanceId : 'default-instance' ,
10
+ sourceType : 'default-source-type' ,
11
+ sourceCategory : 'default-category' ,
12
+ trackingPlanId : 'default-tracking-plan' ,
13
+ trackingPlanVersion : 1 ,
14
+ sourceTpConfig : { } ,
15
+ mergedTpConfig : { } ,
16
+ destinationId : 'default-destinationId' ,
17
+ jobRunId : 'default-job-run' ,
18
+ jobId : 1 ,
19
+ sourceBatchId : 'default-batch' ,
20
+ sourceJobId : 'default-source-job' ,
21
+ sourceJobRunId : 'default-source-job-run' ,
22
+ sourceTaskId : 'default-task' ,
23
+ sourceTaskRunId : 'default-task-run' ,
24
+ recordId : { } ,
25
+ destinationType : 'default-destination-type' ,
26
+ messageId : 'default-message-id' ,
27
+ oauthAccessToken : 'default-token' ,
28
+ messageIds : [ 'default-message-id' ] ,
29
+ rudderId : 'default-rudder-id' ,
30
+ receivedAt : '2025-01-06T04:12:38.713Z' ,
31
+ eventName : 'default-event' ,
32
+ eventType : 'default-type' ,
33
+ sourceDefinitionId : 'default-source-def' ,
34
+ destinationDefinitionId : 'default-dest-def' ,
35
+ transformationId : 'default-transform' ,
36
+ dontBatch : false ,
37
+ } ;
8
38
9
39
const destination : Destination = {
10
40
ID : '123' ,
@@ -29,23 +59,6 @@ const destination: Destination = {
29
59
Enabled : true ,
30
60
} ;
31
61
32
- const headers = {
33
- api_key : 'testApiKey' ,
34
- 'Content-Type' : 'application/json' ,
35
- } ;
36
-
37
- const properties = {
38
- path : '/abc' ,
39
- referrer : '' ,
40
- search : '' ,
41
- title : '' ,
42
- url : '' ,
43
- category : 'test-category' ,
44
- } ;
45
-
46
- const sentAt = '2020-08-28T16:26:16.473Z' ;
47
- const originalTimestamp = '2020-08-28T16:26:06.468Z' ;
48
-
49
62
export const aliasTestData : ProcessorTestData [ ] = [
50
63
{
51
64
id : 'iterable-alias-test-1' ,
@@ -59,42 +72,62 @@ export const aliasTestData: ProcessorTestData[] = [
59
72
version : 'v0' ,
60
73
input : {
61
74
request : {
75
+ method : 'POST' ,
62
76
body : [
63
77
{
64
- destination,
65
78
message : {
66
79
anonymousId : 'anonId' ,
67
80
68
81
69
82
name : 'ApplicationLoaded' ,
70
83
context : { } ,
71
- properties,
84
+ properties : {
85
+ path : '/abc' ,
86
+ referrer : '' ,
87
+ search : '' ,
88
+ title : '' ,
89
+ url : '' ,
90
+ category : 'test-category' ,
91
+ } ,
72
92
type : 'alias' ,
73
- sentAt,
74
- originalTimestamp,
93
+ sentAt : '2020-08-28T16:26:16.473Z' ,
94
+ originalTimestamp : '2020-08-28T16:26:06.468Z' ,
75
95
} ,
76
- metadata : generateMetadata ( 1 ) ,
96
+ metadata : baseMetadata ,
97
+ destination,
77
98
} ,
78
99
] ,
79
- method : 'POST' ,
80
100
} ,
81
101
} ,
82
102
output : {
83
103
response : {
84
104
status : 200 ,
85
105
body : [
86
106
{
87
- output : transformResultBuilder ( {
107
+ output : {
108
+ version : '1' ,
109
+ type : 'REST' ,
88
110
userId : '' ,
89
- headers ,
111
+ method : 'POST' ,
90
112
endpoint : 'https://api.iterable.com/api/users/updateEmail' ,
91
- JSON : {
92
- currentEmail :
'[email protected] ' ,
93
-
113
+ headers : {
114
+ api_key : 'testApiKey' ,
115
+ 'Content-Type' : 'application/json' ,
116
+ } ,
117
+ params : { } ,
118
+ body : {
119
+ JSON : {
120
+ currentEmail :
'[email protected] ' ,
121
+
122
+ } ,
123
+ JSON_ARRAY : { } ,
124
+ XML : { } ,
125
+ FORM : { } ,
94
126
} ,
95
- } ) ,
127
+ files : { } ,
128
+ } ,
129
+ metadata : baseMetadata ,
96
130
statusCode : 200 ,
97
- metadata : generateMetadata ( 1 ) ,
98
131
} ,
99
132
] ,
100
133
} ,
@@ -112,42 +145,62 @@ export const aliasTestData: ProcessorTestData[] = [
112
145
version : 'v0' ,
113
146
input : {
114
147
request : {
148
+ method : 'POST' ,
115
149
body : [
116
150
{
117
- destination : overrideDestination ( destination , { dataCenter : 'EUDC' } ) ,
118
151
message : {
119
152
anonymousId : 'anonId' ,
120
153
121
154
122
155
name : 'ApplicationLoaded' ,
123
156
context : { } ,
124
- properties,
157
+ properties : {
158
+ path : '/abc' ,
159
+ referrer : '' ,
160
+ search : '' ,
161
+ title : '' ,
162
+ url : '' ,
163
+ category : 'test-category' ,
164
+ } ,
125
165
type : 'alias' ,
126
- sentAt,
127
- originalTimestamp,
166
+ sentAt : '2020-08-28T16:26:16.473Z' ,
167
+ originalTimestamp : '2020-08-28T16:26:06.468Z' ,
128
168
} ,
129
- metadata : generateMetadata ( 1 ) ,
169
+ metadata : baseMetadata ,
170
+ destination : overrideDestination ( destination , { dataCenter : 'EUDC' } ) ,
130
171
} ,
131
172
] ,
132
- method : 'POST' ,
133
173
} ,
134
174
} ,
135
175
output : {
136
176
response : {
137
177
status : 200 ,
138
178
body : [
139
179
{
140
- output : transformResultBuilder ( {
180
+ output : {
181
+ version : '1' ,
182
+ type : 'REST' ,
141
183
userId : '' ,
142
- headers ,
184
+ method : 'POST' ,
143
185
endpoint : 'https://api.eu.iterable.com/api/users/updateEmail' ,
144
- JSON : {
145
- currentEmail :
'[email protected] ' ,
146
-
186
+ headers : {
187
+ api_key : 'testApiKey ' ,
188
+ 'Content-Type' : 'application/json ' ,
147
189
} ,
148
- } ) ,
190
+ params : { } ,
191
+ body : {
192
+ JSON : {
193
+ currentEmail :
'[email protected] ' ,
194
+
195
+ } ,
196
+ JSON_ARRAY : { } ,
197
+ XML : { } ,
198
+ FORM : { } ,
199
+ } ,
200
+ files : { } ,
201
+ } ,
202
+ metadata : baseMetadata ,
149
203
statusCode : 200 ,
150
- metadata : generateMetadata ( 1 ) ,
151
204
} ,
152
205
] ,
153
206
} ,
0 commit comments