Skip to content

Commit

Permalink
chore: comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishmalik committed Feb 27, 2024
1 parent 795a31e commit 71207b6
Show file tree
Hide file tree
Showing 4 changed files with 253 additions and 81 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ProxyV1TestData } from '../../../testTypes';
import {
generateMetadata,
generateProxyV0Payload,
generateProxyV1Payload,
} from '../../../testUtils';
Expand All @@ -22,7 +23,7 @@ const commonRequestParameters = {
},
};

export const businessTestScenarios = [
export const businessV0TestScenarios = [
{
id: 'snapchat_custom_audience_v0_oauth_scenario_1',
name: 'snapchat_custom_audience',
Expand Down Expand Up @@ -71,8 +72,11 @@ export const businessTestScenarios = [
},
},
},
];

export const businessV1TestScenarios: ProxyV1TestData[] = [
{
id: 'snapchat_custom_audience_v0_oauth_scenario_1',
id: 'snapchat_custom_audience_v1_oauth_scenario_1',
name: 'snapchat_custom_audience',
description: '[Proxy v1 API] :: successfull oauth',
successCriteria: 'Proper response from destination is received',
Expand Down Expand Up @@ -103,18 +107,7 @@ export const businessTestScenarios = [
{
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,
},
metadata: generateMetadata(1),
},
],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { businessTestScenarios } from './business';
import { businessV0TestScenarios, businessV1TestScenarios } from './business';
import { v0OauthScenarios, v1OauthScenarios } from './oauth';
import { otherScenariosV1 } from './other';

export const data = [ ...v0OauthScenarios, ...v1OauthScenarios, ...businessTestScenarios];
export const data = [
...v0OauthScenarios,
...v1OauthScenarios,
...businessV0TestScenarios,
...businessV1TestScenarios,
...otherScenariosV1,
];
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { ProxyV1TestData } from '../../../testTypes';
import { generateProxyV1Payload, generateProxyV0Payload } from '../../../testUtils';
import {
generateMetadata,
generateProxyV0Payload,
generateProxyV1Payload,
} from '../../../testUtils';

const commonHeaders = {
Authorization: 'Bearer abcd123',
Expand Down Expand Up @@ -32,6 +36,28 @@ const commonDeleteRequestParameters = {
},
};

const retryStatTags = {
destType: 'SNAPCHAT_CUSTOM_AUDIENCE',
errorCategory: 'network',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
errorType: 'retryable',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
};

const abortStatTags = {
destType: 'SNAPCHAT_CUSTOM_AUDIENCE',
errorCategory: 'network',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
errorType: 'aborted',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
};

export const v0OauthScenarios = [
{
id: 'snapchat_custom_audience_v0_oauth_scenario_2',
Expand Down Expand Up @@ -68,16 +94,7 @@ export const v0OauthScenarios = [
},
message:
'Failed with unauthorized during snapchat_custom_audience response transformation',
statTags: {
destType: 'SNAPCHAT_CUSTOM_AUDIENCE',
errorCategory: 'network',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
errorType: 'retryable',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
},
statTags: retryStatTags,
authErrorCategory: 'REFRESH_TOKEN',
},
},
Expand Down Expand Up @@ -126,16 +143,7 @@ export const v0OauthScenarios = [
status: 403,
},
message: 'undefined during snapchat_custom_audience response transformation',
statTags: {
destType: 'SNAPCHAT_CUSTOM_AUDIENCE',
errorCategory: 'network',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
errorType: 'aborted',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
},
statTags: abortStatTags,
},
},
},
Expand Down Expand Up @@ -176,30 +184,10 @@ export const v1OauthScenarios: ProxyV1TestData[] = [
{
error: '"unauthorized"',
statusCode: 500,
metadata: {
jobId: 1,
attemptNum: 1,
userId: 'default-userId',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
sourceId: 'default-sourceId',
secret: {
accessToken: 'default-accessToken',
},
dontBatch: false,
},
metadata: generateMetadata(1),
},
],
statTags: {
errorCategory: 'network',
errorType: 'retryable',
destType: 'SNAPCHAT_CUSTOM_AUDIENCE',
module: 'destination',
implementation: 'native',
feature: 'dataDelivery',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
},
statTags: retryStatTags,
authErrorCategory: 'REFRESH_TOKEN',
message:
'Failed with unauthorized during snapchat_custom_audience response transformation',
Expand Down Expand Up @@ -241,30 +229,10 @@ export const v1OauthScenarios: ProxyV1TestData[] = [
{
error: `{"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"}`,
statusCode: 400,
metadata: {
jobId: 1,
attemptNum: 1,
userId: 'default-userId',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
sourceId: 'default-sourceId',
secret: {
accessToken: 'default-accessToken',
},
dontBatch: false,
},
metadata: generateMetadata(1),
},
],
statTags: {
errorCategory: 'network',
errorType: 'aborted',
destType: 'SNAPCHAT_CUSTOM_AUDIENCE',
module: 'destination',
implementation: 'native',
feature: 'dataDelivery',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
},
statTags: abortStatTags,
message: 'undefined during snapchat_custom_audience response transformation',
status: 400,
authErrorCategory: 'AUTH_STATUS_INACTIVE',
Expand Down
Loading

0 comments on commit 71207b6

Please sign in to comment.