-
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.
chore: update component tests structure for snapchat custom audience
- Loading branch information
1 parent
84cb5f0
commit 795a31e
Showing
4 changed files
with
436 additions
and
206 deletions.
There are no files selected for viewing
125 changes: 125 additions & 0 deletions
125
test/integrations/destinations/snapchat_custom_audience/dataDelivery/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,125 @@ | ||
import { ProxyV1TestData } from '../../../testTypes'; | ||
import { | ||
generateProxyV0Payload, | ||
generateProxyV1Payload, | ||
} from '../../../testUtils'; | ||
|
||
const commonHeaders = { | ||
Authorization: 'Bearer abcd123', | ||
'Content-Type': 'application/json', | ||
'User-Agent': 'RudderLabs', | ||
}; | ||
|
||
const commonRequestParameters = { | ||
headers: commonHeaders, | ||
JSON: { | ||
users: [ | ||
{ | ||
schema: ['EMAIL_SHA256'], | ||
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
export const businessTestScenarios = [ | ||
{ | ||
id: 'snapchat_custom_audience_v0_oauth_scenario_1', | ||
name: 'snapchat_custom_audience', | ||
description: '[Proxy v0 API] :: successfull call', | ||
successCriteria: 'Proper response from destination is received', | ||
scenario: 'Oauth', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: generateProxyV0Payload({ | ||
...commonRequestParameters, | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users', | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 200, | ||
message: 'Request Processed Successfully', | ||
destinationResponse: { | ||
response: { | ||
request_status: 'SUCCESS', | ||
request_id: '12345', | ||
users: [ | ||
{ | ||
sub_request_status: 'SUCCESS', | ||
user: { | ||
number_uploaded_users: 1, | ||
}, | ||
}, | ||
], | ||
}, | ||
status: 200, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
id: 'snapchat_custom_audience_v0_oauth_scenario_1', | ||
name: 'snapchat_custom_audience', | ||
description: '[Proxy v1 API] :: successfull oauth', | ||
successCriteria: 'Proper response from destination is received', | ||
scenario: 'Oauth', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v1', | ||
input: { | ||
request: { | ||
body: generateProxyV1Payload({ | ||
...commonRequestParameters, | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users', | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 200, | ||
message: 'Request Processed Successfully', | ||
response: [ | ||
{ | ||
error: `{\"request_status\":\"SUCCESS\",\"request_id\":\"12345\",\"users\":[{\"sub_request_status\":\"SUCCESS\",\"user\":{\"number_uploaded_users\":1}}]}`, | ||
statusCode: 200, | ||
metadata: { | ||
jobId: 1, | ||
attemptNum: 1, | ||
userId: 'default-userId', | ||
destinationId: 'default-destinationId', | ||
workspaceId: 'default-workspaceId', | ||
sourceId: 'default-sourceId', | ||
secret: { | ||
accessToken: 'default-accessToken', | ||
}, | ||
dontBatch: false, | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
210 changes: 4 additions & 206 deletions
210
test/integrations/destinations/snapchat_custom_audience/dataDelivery/data.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 |
---|---|---|
@@ -1,206 +1,4 @@ | ||
export const data = [ | ||
{ | ||
name: 'snapchat_custom_audience', | ||
description: 'Test 0', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: { | ||
version: '1', | ||
type: 'REST', | ||
method: 'POST', | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users', | ||
headers: { | ||
Authorization: 'Bearer abcd123', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: { | ||
JSON: { | ||
users: [ | ||
{ | ||
schema: ['EMAIL_SHA256'], | ||
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']], | ||
}, | ||
], | ||
}, | ||
JSON_ARRAY: {}, | ||
XML: {}, | ||
FORM: {}, | ||
}, | ||
files: {}, | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}, | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 200, | ||
message: 'Request Processed Successfully', | ||
destinationResponse: { | ||
response: { | ||
request_status: 'SUCCESS', | ||
request_id: '12345', | ||
users: [ | ||
{ | ||
sub_request_status: 'SUCCESS', | ||
user: { | ||
number_uploaded_users: 1, | ||
}, | ||
}, | ||
], | ||
}, | ||
status: 200, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'snapchat_custom_audience', | ||
description: 'Test 1', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: { | ||
version: '1', | ||
type: 'REST', | ||
method: 'POST', | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/456/users', | ||
headers: { | ||
Authorization: 'Bearer abcd123', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: { | ||
JSON: { | ||
users: [ | ||
{ | ||
schema: ['EMAIL_SHA256'], | ||
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']], | ||
}, | ||
], | ||
}, | ||
JSON_ARRAY: {}, | ||
XML: {}, | ||
FORM: {}, | ||
}, | ||
files: {}, | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}, | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 500, | ||
body: { | ||
output: { | ||
status: 500, | ||
destinationResponse: { | ||
response: 'unauthorized', | ||
status: 401, | ||
}, | ||
message: | ||
'Failed with unauthorized during snapchat_custom_audience response transformation', | ||
statTags: { | ||
destType: 'SNAPCHAT_CUSTOM_AUDIENCE', | ||
errorCategory: 'network', | ||
destinationId: 'Non-determininable', | ||
workspaceId: 'Non-determininable', | ||
errorType: 'retryable', | ||
feature: 'dataDelivery', | ||
implementation: 'native', | ||
module: 'destination', | ||
}, | ||
authErrorCategory: 'REFRESH_TOKEN', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'snapchat_custom_audience', | ||
description: 'Test 2', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: { | ||
version: '1', | ||
type: 'REST', | ||
method: 'DELETE', | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/789/users', | ||
headers: { | ||
Authorization: 'Bearer abcd123', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: { | ||
JSON: { | ||
users: [ | ||
{ | ||
id: '123456', | ||
schema: ['EMAIL_SHA256'], | ||
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']], | ||
}, | ||
], | ||
}, | ||
JSON_ARRAY: {}, | ||
XML: {}, | ||
FORM: {}, | ||
}, | ||
files: {}, | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}, | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 400, | ||
body: { | ||
output: { | ||
authErrorCategory: 'AUTH_STATUS_INACTIVE', | ||
status: 400, | ||
destinationResponse: { | ||
response: { | ||
request_status: 'ERROR', | ||
request_id: '98e2a602-3cf4-4596-a8f9-7f034161f89a', | ||
debug_message: 'Caller does not have permission', | ||
display_message: | ||
"We're sorry, but the requested resource is not available at this time", | ||
error_code: 'E3002', | ||
}, | ||
status: 403, | ||
}, | ||
message: 'undefined during snapchat_custom_audience response transformation', | ||
statTags: { | ||
destType: 'SNAPCHAT_CUSTOM_AUDIENCE', | ||
errorCategory: 'network', | ||
destinationId: 'Non-determininable', | ||
workspaceId: 'Non-determininable', | ||
errorType: 'aborted', | ||
feature: 'dataDelivery', | ||
implementation: 'native', | ||
module: 'destination', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
import { businessTestScenarios } from './business'; | ||
import { v0OauthScenarios, v1OauthScenarios } from './oauth'; | ||
|
||
export const data = [ ...v0OauthScenarios, ...v1OauthScenarios, ...businessTestScenarios]; |
Oops, something went wrong.