Skip to content

Commit

Permalink
chore: add other scenario tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Feb 26, 2024
1 parent 16ac116 commit 9357876
Show file tree
Hide file tree
Showing 2 changed files with 295 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/integrations/destinations/marketo/dataDelivery/data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AxiosError } from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { testScenariosForV1API } from './business';
import { otheMarketoScenariosV1 } from './other';

const legacyTests = [
{
Expand Down Expand Up @@ -493,4 +494,4 @@ const legacyTests = [
},
];

export const data = [...legacyTests, ...testScenariosForV1API];
export const data = [...legacyTests, ...testScenariosForV1API, ...otheMarketoScenariosV1];
293 changes: 293 additions & 0 deletions test/integrations/destinations/marketo/dataDelivery/other.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
import { ProxyV1TestData } from '../../../testTypes';
import { generateProxyV1Payload } from '../../../testUtils';

export const otheMarketoScenariosV1: ProxyV1TestData[] = [
{
id: 'marketo_v1_other_scenario_1',
name: 'marketo',
description:
'[Proxy v1 API] :: Scenario for testing Service Unavailable error from destination',
successCriteria: 'Should return 503 status code with error message',
scenario: 'Framework',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: 'https://random_test_url/test_for_service_not_available',
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
response: [
{
error:
'{"error":{"message":"Service Unavailable","description":"The server is currently unable to handle the request due to temporary overloading or maintenance of the server. Please try again later."}}',
statusCode: 503,
metadata: {
jobId: 1,
attemptNum: 1,
userId: 'default-userId',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
sourceId: 'default-sourceId',
secret: {
accessToken: 'default-accessToken',
},
dontBatch: false,
},
},
],
statTags: {
errorCategory: 'network',
errorType: 'retryable',
destType: 'MARKETO',
module: 'destination',
implementation: 'native',
feature: 'dataDelivery',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
},
message: 'Request failed with status: 503',
status: 503,
},
},
},
},
},
{
id: 'marketo_v1_other_scenario_2',
name: 'marketo',
description: '[Proxy v1 API] :: Scenario for testing Internal Server error from destination',
successCriteria: 'Should return 500 status code with error message',
scenario: 'Framework',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: 'https://random_test_url/test_for_internal_server_error',
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
response: [
{
error: '"Internal Server Error"',
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,
},
},
],
statTags: {
errorCategory: 'network',
errorType: 'retryable',
destType: 'MARKETO',
module: 'destination',
implementation: 'native',
feature: 'dataDelivery',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
},
message: 'Request failed with status: 500',
status: 500,
},
},
},
},
},
{
id: 'marketo_v1_other_scenario_3',
name: 'marketo',
description: '[Proxy v1 API] :: Scenario for testing Gateway Time Out error from destination',
successCriteria: 'Should return 504 status code with error message',
scenario: 'Framework',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: 'https://random_test_url/test_for_gateway_time_out',
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
response: [
{
error: '"Gateway Timeout"',
statusCode: 504,
metadata: {
jobId: 1,
attemptNum: 1,
userId: 'default-userId',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
sourceId: 'default-sourceId',
secret: {
accessToken: 'default-accessToken',
},
dontBatch: false,
},
},
],
statTags: {
errorCategory: 'network',
errorType: 'retryable',
destType: 'MARKETO',
module: 'destination',
implementation: 'native',
feature: 'dataDelivery',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
},
message: 'Request failed with status: 504',
status: 504,
},
},
},
},
},
{
id: 'marketo_v1_other_scenario_4',
name: 'marketo',
description: '[Proxy v1 API] :: Scenario for testing null response from destination',
successCriteria: 'Should return 500 status code with empty error message',
scenario: 'Framework',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: 'https://random_test_url/test_for_null_response',
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
response: [
{
error: '""',
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,
},
},
],
statTags: {
errorCategory: 'network',
errorType: 'retryable',
destType: 'MARKETO',
module: 'destination',
implementation: 'native',
feature: 'dataDelivery',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
},
message: 'Request failed with status: 500',
status: 500,
},
},
},
},
},
{
id: 'marketo_v1_other_scenario_5',
name: 'marketo',
description:
'[Proxy v1 API] :: Scenario for testing null and no status response from destination',
successCriteria: 'Should return 500 status code with empty error message',
scenario: 'Framework',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload({
endpoint: 'https://random_test_url/test_for_null_and_no_status',
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
response: [
{
error: '""',
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,
},
},
],
statTags: {
errorCategory: 'network',
errorType: 'retryable',
destType: 'MARKETO',
module: 'destination',
implementation: 'native',
feature: 'dataDelivery',
destinationId: 'default-destinationId',
workspaceId: 'default-workspaceId',
},
message: 'Request failed with status: 500',
status: 500,
},
},
},
},
},
];

0 comments on commit 9357876

Please sign in to comment.