Skip to content

Commit ebfeffc

Browse files
committed
fix: migrating processor and router test cases
1 parent 933473a commit ebfeffc

File tree

7 files changed

+2830
-1001
lines changed

7 files changed

+2830
-1001
lines changed

test/integrations/destinations/iterable/dataDelivery/business.ts

+1-26
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,7 @@ export const statTags = {
2121
module: 'destination',
2222
};
2323

24-
export const metadata = [
25-
{
26-
jobId: 1,
27-
attemptNum: 1,
28-
userId: 'default-userId',
29-
destinationId: 'default-destinationId',
30-
workspaceId: 'default-workspaceId',
31-
sourceId: 'default-sourceId',
32-
secret: {
33-
accessToken: 'default-accessToken',
34-
},
35-
dontBatch: false,
36-
},
37-
{
38-
jobId: 2,
39-
attemptNum: 1,
40-
userId: 'default-userId',
41-
destinationId: 'default-destinationId',
42-
workspaceId: 'default-workspaceId',
43-
sourceId: 'default-sourceId',
44-
secret: {
45-
accessToken: 'default-accessToken',
46-
},
47-
dontBatch: false,
48-
},
49-
];
24+
export const metadata = [generateMetadata(1), generateMetadata(2)];
5025

5126
export const singleMetadata = [
5227
{

test/integrations/destinations/iterable/processor/aliasTestData.ts

+102-49
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,40 @@
1-
import {
2-
generateMetadata,
3-
overrideDestination,
4-
transformResultBuilder,
5-
} from './../../../testUtils';
6-
import { Destination } from '../../../../../src/types';
71
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+
};
838

939
const destination: Destination = {
1040
ID: '123',
@@ -29,23 +59,6 @@ const destination: Destination = {
2959
Enabled: true,
3060
};
3161

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-
4962
export const aliasTestData: ProcessorTestData[] = [
5063
{
5164
id: 'iterable-alias-test-1',
@@ -59,42 +72,62 @@ export const aliasTestData: ProcessorTestData[] = [
5972
version: 'v0',
6073
input: {
6174
request: {
75+
method: 'POST',
6276
body: [
6377
{
64-
destination,
6578
message: {
6679
anonymousId: 'anonId',
6780
userId: '[email protected]',
6881
previousId: '[email protected]',
6982
name: 'ApplicationLoaded',
7083
context: {},
71-
properties,
84+
properties: {
85+
path: '/abc',
86+
referrer: '',
87+
search: '',
88+
title: '',
89+
url: '',
90+
category: 'test-category',
91+
},
7292
type: 'alias',
73-
sentAt,
74-
originalTimestamp,
93+
sentAt: '2020-08-28T16:26:16.473Z',
94+
originalTimestamp: '2020-08-28T16:26:06.468Z',
7595
},
76-
metadata: generateMetadata(1),
96+
metadata: baseMetadata,
97+
destination,
7798
},
7899
],
79-
method: 'POST',
80100
},
81101
},
82102
output: {
83103
response: {
84104
status: 200,
85105
body: [
86106
{
87-
output: transformResultBuilder({
107+
output: {
108+
version: '1',
109+
type: 'REST',
88110
userId: '',
89-
headers,
111+
method: 'POST',
90112
endpoint: 'https://api.iterable.com/api/users/updateEmail',
91-
JSON: {
92-
currentEmail: '[email protected]',
93-
newEmail: '[email protected]',
113+
headers: {
114+
api_key: 'testApiKey',
115+
'Content-Type': 'application/json',
116+
},
117+
params: {},
118+
body: {
119+
JSON: {
120+
currentEmail: '[email protected]',
121+
newEmail: '[email protected]',
122+
},
123+
JSON_ARRAY: {},
124+
XML: {},
125+
FORM: {},
94126
},
95-
}),
127+
files: {},
128+
},
129+
metadata: baseMetadata,
96130
statusCode: 200,
97-
metadata: generateMetadata(1),
98131
},
99132
],
100133
},
@@ -112,42 +145,62 @@ export const aliasTestData: ProcessorTestData[] = [
112145
version: 'v0',
113146
input: {
114147
request: {
148+
method: 'POST',
115149
body: [
116150
{
117-
destination: overrideDestination(destination, { dataCenter: 'EUDC' }),
118151
message: {
119152
anonymousId: 'anonId',
120153
userId: '[email protected]',
121154
previousId: '[email protected]',
122155
name: 'ApplicationLoaded',
123156
context: {},
124-
properties,
157+
properties: {
158+
path: '/abc',
159+
referrer: '',
160+
search: '',
161+
title: '',
162+
url: '',
163+
category: 'test-category',
164+
},
125165
type: 'alias',
126-
sentAt,
127-
originalTimestamp,
166+
sentAt: '2020-08-28T16:26:16.473Z',
167+
originalTimestamp: '2020-08-28T16:26:06.468Z',
128168
},
129-
metadata: generateMetadata(1),
169+
metadata: baseMetadata,
170+
destination: overrideDestination(destination, { dataCenter: 'EUDC' }),
130171
},
131172
],
132-
method: 'POST',
133173
},
134174
},
135175
output: {
136176
response: {
137177
status: 200,
138178
body: [
139179
{
140-
output: transformResultBuilder({
180+
output: {
181+
version: '1',
182+
type: 'REST',
141183
userId: '',
142-
headers,
184+
method: 'POST',
143185
endpoint: 'https://api.eu.iterable.com/api/users/updateEmail',
144-
JSON: {
145-
currentEmail: '[email protected]',
146-
newEmail: '[email protected]',
186+
headers: {
187+
api_key: 'testApiKey',
188+
'Content-Type': 'application/json',
147189
},
148-
}),
190+
params: {},
191+
body: {
192+
JSON: {
193+
currentEmail: '[email protected]',
194+
newEmail: '[email protected]',
195+
},
196+
JSON_ARRAY: {},
197+
XML: {},
198+
FORM: {},
199+
},
200+
files: {},
201+
},
202+
metadata: baseMetadata,
149203
statusCode: 200,
150-
metadata: generateMetadata(1),
151204
},
152205
],
153206
},

0 commit comments

Comments
 (0)