Skip to content

Commit

Permalink
chore: updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepdsvs committed Mar 4, 2024
1 parent 4ad6521 commit edd4555
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,84 +255,4 @@ export const testScenariosForV1API: ProxyV1TestData[] = [
},
},
},
{
id: 'facebook_pixel_v1_scenario_7',
name: 'facebook_pixel',
description: 'app event fails due to missing permissions',
successCriteria: 'Should return 400 with missing permissions error',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: `https://graph.facebook.com/${VERSION}/1234567891234571/events?access_token=valid_access_token`,
FORM: testFormData,
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 400,
message: 'Capability or permissions issue.',
statTags,
response: [
{
error: 'Capability or permissions issue.',
statusCode: 400,
metadata: generateMetadata(1),
},
],
},
},
},
},
},
{
id: 'facebook_pixel_v1_scenario_8',
name: 'facebook_pixel',
description: 'app event fails due to Unhandled random error',
successCriteria: 'Should return 500 with Unhandled random error',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: `https://graph.facebook.com/${VERSION}/1234567891234572/events?access_token=valid_access_token_unhandled_response`,
FORM: testFormData,
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 500,
message: 'Unhandled random error',
statTags: {
...statTags,
errorType: 'retryable',
meta: 'unhandledStatusCode',
},
response: [
{
error: 'Unhandled random error',
statusCode: 500,
metadata: generateMetadata(1),
},
],
},
},
},
},
},
];
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { VERSION } from '../../../../../src/v0/destinations/facebook_pixel/config';
import { testScenariosForV1API, testFormData, statTags as baseStatTags } from './business';
import { otherScenariosV1 } from './other';
import { oauthScenariosV1 } from './oauth';

const statTags = {
...baseStatTags,
Expand Down Expand Up @@ -488,4 +489,9 @@ export const v0TestData = [
},
];

export const data = [...v0TestData, ...testScenariosForV1API, ...otherScenariosV1];
export const data = [
...v0TestData,
...testScenariosForV1API,
...otherScenariosV1,
...oauthScenariosV1,
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { testFormData, statTags } from './business';
import { generateProxyV1Payload, generateMetadata } from '../../../testUtils';
import { ProxyV1TestData } from '../../../testTypes';
import { VERSION } from '../../../../../src/v0/destinations/facebook_pixel/config';

export const oauthScenariosV1: ProxyV1TestData[] = [
{
id: 'facebook_pixel_v1_oauth_scenario_1',
name: 'facebook_pixel',
description: 'app event fails due to missing permissions',
successCriteria: 'Should return 400 with missing permissions error',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: `https://graph.facebook.com/${VERSION}/1234567891234571/events?access_token=valid_access_token`,
FORM: testFormData,
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 400,
message: 'Capability or permissions issue.',
statTags,
response: [
{
error: 'Capability or permissions issue.',
statusCode: 400,
metadata: generateMetadata(1),
},
],
},
},
},
},
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,46 @@ export const otherScenariosV1: ProxyV1TestData[] = [
},
},
},
{
id: 'facebook_pixel_v1_other_scenario_2',
name: 'facebook_pixel',
description: 'app event fails due to Unhandled random error',
successCriteria: 'Should return 500 with Unhandled random error',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: `https://graph.facebook.com/${VERSION}/1234567891234572/events?access_token=valid_access_token_unhandled_response`,
FORM: testFormData,
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
status: 500,
message: 'Unhandled random error',
statTags: {
...statTags,
errorType: 'retryable',
meta: 'unhandledStatusCode',
},
response: [
{
error: 'Unhandled random error',
statusCode: 500,
metadata: generateMetadata(1),
},
],
},
},
},
},
},
];

0 comments on commit edd4555

Please sign in to comment.