-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: trade desk proxy testcases
- Loading branch information
1 parent
a5d20ad
commit 6fdf273
Showing
4 changed files
with
280 additions
and
2 deletions.
There are no files selected for viewing
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
175 changes: 175 additions & 0 deletions
175
test/integrations/destinations/the_trade_desk/delivery/business.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,175 @@ | ||
import { ProxyV1TestData } from '../../../testTypes'; | ||
import { generateProxyV1Payload, generateMetadata } from '../../../testUtils'; | ||
import { | ||
destType, | ||
advertiserId, | ||
dataProviderId, | ||
segmentName, | ||
sampleDestination, | ||
proxyV1NetworkErrorStatTags, | ||
firstPartyDataEndpoint, | ||
} from '../common'; | ||
|
||
const validRequestPayload1 = { | ||
AdvertiserId: advertiserId, | ||
DataProviderId: dataProviderId, | ||
Items: [ | ||
{ | ||
DAID: 'test-daid-1', | ||
Data: [ | ||
{ | ||
Name: segmentName, | ||
TTLInMinutes: 43200, | ||
}, | ||
], | ||
}, | ||
{ | ||
Data: [ | ||
{ | ||
Name: segmentName, | ||
TTLInMinutes: 43200, | ||
}, | ||
], | ||
UID2: 'test-uid2-1', | ||
}, | ||
{ | ||
DAID: 'test-daid-2', | ||
Data: [ | ||
{ | ||
Name: segmentName, | ||
TTLInMinutes: 0, | ||
}, | ||
], | ||
}, | ||
{ | ||
Data: [ | ||
{ | ||
Name: segmentName, | ||
TTLInMinutes: 0, | ||
}, | ||
], | ||
UID2: 'test-uid2-2', | ||
}, | ||
], | ||
}; | ||
|
||
const invalidRequestPayload1 = { | ||
AdvertiserId: advertiserId, | ||
DataProviderId: dataProviderId, | ||
Items: [ | ||
{ | ||
DAID: 'test-daid', | ||
Data: [ | ||
{ | ||
Name: segmentName, | ||
TTLInMinutes: 43200, | ||
}, | ||
], | ||
}, | ||
{ | ||
Data: [ | ||
{ | ||
Name: segmentName, | ||
TTLInMinutes: 43200, | ||
}, | ||
], | ||
UID2: 'test-invalid-uid2', | ||
}, | ||
], | ||
}; | ||
|
||
const metadataArray = [generateMetadata(1)]; | ||
|
||
export const businessProxyV1: ProxyV1TestData[] = [ | ||
{ | ||
id: 'ttd_v1_scenario_1', | ||
name: destType, | ||
description: | ||
'[Proxy v1 API] :: Test for a valid request - Successful delivery of Add/Remove IDs to Trade Desk', | ||
successCriteria: 'Should return 200 with no error with destination response', | ||
scenario: 'Business', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v1', | ||
input: { | ||
request: { | ||
body: generateProxyV1Payload( | ||
{ | ||
headers: {}, | ||
params: {}, | ||
JSON: validRequestPayload1, | ||
endpoint: firstPartyDataEndpoint, | ||
}, | ||
metadataArray, | ||
sampleDestination.Config, | ||
), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 200, | ||
message: 'Request Processed Successfully', | ||
response: [ | ||
{ | ||
statusCode: 200, | ||
metadata: generateMetadata(1), | ||
error: '{}', | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
id: 'ttd_v1_scenario_2', | ||
name: destType, | ||
description: | ||
'[Proxy v1 API] :: Test for invalid ID - where the destination responds with 200 with invalid ID', | ||
successCriteria: 'Should return 400 with error with destination response', | ||
scenario: 'Business', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v1', | ||
input: { | ||
request: { | ||
body: generateProxyV1Payload( | ||
{ | ||
headers: {}, | ||
params: {}, | ||
JSON: invalidRequestPayload1, | ||
endpoint: firstPartyDataEndpoint, | ||
}, | ||
metadataArray, | ||
sampleDestination.Config, | ||
), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
message: | ||
'Request failed with status: 200 due to {"FailedLines":[{"ErrorCode":"MissingUserId","Message":"Invalid UID2, item #2"}]}', | ||
response: [ | ||
{ | ||
error: | ||
'{"FailedLines":[{"ErrorCode":"MissingUserId","Message":"Invalid UID2, item #2"}]}', | ||
metadata: generateMetadata(1), | ||
statusCode: 400, | ||
}, | ||
], | ||
statTags: proxyV1NetworkErrorStatTags, | ||
status: 400, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
78 changes: 78 additions & 0 deletions
78
test/integrations/destinations/the_trade_desk/delivery/other.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,78 @@ | ||
import { ProxyV1TestData } from '../../../testTypes'; | ||
import { generateProxyV1Payload, generateMetadata } from '../../../testUtils'; | ||
import { | ||
destType, | ||
advertiserId, | ||
dataProviderId, | ||
segmentName, | ||
proxyV1PlatformErrorStatTags, | ||
firstPartyDataEndpoint, | ||
} from '../common'; | ||
import { envMock } from '../mocks'; | ||
|
||
envMock(); | ||
|
||
const validRequestPayload1 = { | ||
AdvertiserId: advertiserId, | ||
DataProviderId: dataProviderId, | ||
Items: [ | ||
{ | ||
DAID: 'test-daid-1', | ||
Data: [ | ||
{ | ||
Name: segmentName, | ||
TTLInMinutes: 43200, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
const metadataArray = [generateMetadata(1)]; | ||
|
||
export const otherProxyV1: ProxyV1TestData[] = [ | ||
{ | ||
id: 'ttd_v1_scenario_1', | ||
name: destType, | ||
description: | ||
'[Proxy v1 API] :: Missing advertiser secret key in destination config from proxy request from server', | ||
successCriteria: 'Should return 400 with platform error', | ||
scenario: 'Framework', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v1', | ||
input: { | ||
request: { | ||
body: generateProxyV1Payload( | ||
{ | ||
headers: {}, | ||
params: {}, | ||
JSON: validRequestPayload1, | ||
endpoint: firstPartyDataEndpoint, | ||
}, | ||
metadataArray, | ||
), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
message: 'Advertiser secret key is missing in destination config. Aborting', | ||
response: [ | ||
{ | ||
error: 'Advertiser secret key is missing in destination config. Aborting', | ||
metadata: generateMetadata(1), | ||
statusCode: 400, | ||
}, | ||
], | ||
statTags: proxyV1PlatformErrorStatTags, | ||
status: 400, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
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