Skip to content

Commit

Permalink
test: add testcase for batching on max request size
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauravudia committed Apr 1, 2024
1 parent 2bd91e3 commit 86730d9
Show file tree
Hide file tree
Showing 2 changed files with 317 additions and 0 deletions.
180 changes: 180 additions & 0 deletions test/integrations/destinations/movable_ink/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,186 @@ const trackTestProperties = {
position: 2,
category: 'Games',
},
{
product_id: '122c6f5d5cf86a4c77358033',
sku: '7472-998-0112',
name: 'Ticket to Ride',
price: 20,
position: 3,
category: 'Games',
},
{
product_id: '222c6f5d5cf86a4c77358033',
sku: '9472-998-0112',
name: 'Catan',
price: 30,
position: 4,
category: 'Games',
},
{
product_id: '322c6f5d5cf86a4c77358033',
sku: '7472-998-0112',
name: 'Pandemic',
price: 25,
position: 5,
category: 'Games',
},
{
product_id: '422c6f5d5cf86a4c77358033',
sku: '8472-998-0113',
name: 'Exploding Kittens',
price: 15,
position: 6,
category: 'Games',
},
{
product_id: '522c6f5d5cf86a4c77358033',
sku: '8472-998-0114',
name: 'Codenames',
price: 18,
position: 7,
category: 'Games',
},
{
product_id: '622c6f5d5cf86a4c77358034',
sku: '8472-998-0115',
name: 'Scythe',
price: 35,
position: 8,
category: 'Games',
},
{
product_id: '622c6f5d5cf86a4c77358033',
sku: '8472-998-0112',
name: 'Cones of Dunshire',
price: 40,
position: 1,
category: 'Games',
url: 'https://www.website.com/product/path',
image_url: 'https://www.website.com/product/path.jpg',
},
{
product_id: '577c6f5d5cf86a4c7735ba03',
sku: '3309-483-2201',
name: 'Five Crowns',
price: 5,
position: 2,
category: 'Games',
},
{
product_id: '122c6f5d5cf86a4c77358033',
sku: '7472-998-0112',
name: 'Ticket to Ride',
price: 20,
position: 3,
category: 'Games',
},
{
product_id: '222c6f5d5cf86a4c77358033',
sku: '9472-998-0112',
name: 'Catan',
price: 30,
position: 4,
category: 'Games',
},
{
product_id: '322c6f5d5cf86a4c77358033',
sku: '7472-998-0112',
name: 'Pandemic',
price: 25,
position: 5,
category: 'Games',
},
{
product_id: '422c6f5d5cf86a4c77358033',
sku: '8472-998-0113',
name: 'Exploding Kittens',
price: 15,
position: 6,
category: 'Games',
},
{
product_id: '522c6f5d5cf86a4c77358033',
sku: '8472-998-0114',
name: 'Codenames',
price: 18,
position: 7,
category: 'Games',
},
{
product_id: '622c6f5d5cf86a4c77358034',
sku: '8472-998-0115',
name: 'Scythe',
price: 35,
position: 8,
category: 'Games',
},
{
product_id: '622c6f5d5cf86a4c77358033',
sku: '8472-998-0112',
name: 'Cones of Dunshire',
price: 40,
position: 1,
category: 'Games',
url: 'https://www.website.com/product/path',
image_url: 'https://www.website.com/product/path.jpg',
},
{
product_id: '577c6f5d5cf86a4c7735ba03',
sku: '3309-483-2201',
name: 'Five Crowns',
price: 5,
position: 2,
category: 'Games',
},
{
product_id: '122c6f5d5cf86a4c77358033',
sku: '7472-998-0112',
name: 'Ticket to Ride',
price: 20,
position: 3,
category: 'Games',
},
{
product_id: '222c6f5d5cf86a4c77358033',
sku: '9472-998-0112',
name: 'Catan',
price: 30,
position: 4,
category: 'Games',
},
{
product_id: '322c6f5d5cf86a4c77358033',
sku: '7472-998-0112',
name: 'Pandemic',
price: 25,
position: 5,
category: 'Games',
},
{
product_id: '422c6f5d5cf86a4c77358033',
sku: '8472-998-0113',
name: 'Exploding Kittens',
price: 15,
position: 6,
category: 'Games',
},
{
product_id: '522c6f5d5cf86a4c77358033',
sku: '8472-998-0114',
name: 'Codenames',
price: 18,
position: 7,
category: 'Games',
},
{
product_id: '622c6f5d5cf86a4c77358034',
sku: '8472-998-0115',
name: 'Scythe',
price: 35,
position: 8,
category: 'Games',
},
],
},
'Products Searched': { query: 'HDMI cable', url: 'https://www.website.com/product/path' },
Expand Down
137 changes: 137 additions & 0 deletions test/integrations/destinations/movable_ink/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,44 @@ const routerRequest: RouterTransformationRequest = {
destType,
};

// >5KB payload
const routerRequest2: RouterTransformationRequest = {
input: [
{
message: {
type: 'track',
channel,
anonymousId: 'anonId123',
userId: 'userId123',
event: 'Order Completed',
properties: trackTestProperties['Order Completed'],
integrations: {
All: true,
},
originalTimestamp: '2024-03-04T15:32:56.409Z',
},
metadata: generateMetadata(1),
destination,
},
{
message: {
type: 'track',
channel,
anonymousId: 'anonId123',
userId: 'userId123',
event: 'Custom Event',
integrations: {
All: true,
},
originalTimestamp: '2024-03-04T15:32:56.409Z',
},
metadata: generateMetadata(2),
destination,
},
],
destType,
};

export const data = [
{
id: 'MovableInk-router-test-1',
Expand Down Expand Up @@ -215,4 +253,103 @@ export const data = [
},
mockFns: defaultMockFns,
},
{
id: 'MovableInk-router-test-2',
name: destType,
description: 'Basic Router Test to test Max Request Size',
scenario: 'Framework',
successCriteria:
'Some events should be transformed successfully and some should fail for missing fields and status code should be 200',
feature: 'router',
module: 'destination',
version: 'v0',
input: {
request: {
body: routerRequest2,
},
},
output: {
response: {
status: 200,
body: {
output: [
{
batchedRequest: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: destination.Config.endpoint,
headers,
params: {},
body: {
JSON: {
events: [
{
type: 'track',
channel,
userId: 'userId123',
anonymousId: 'anonId123',
event: 'Order Completed',
properties: trackTestProperties['Order Completed'],
integrations: {
All: true,
},
originalTimestamp: '2024-03-04T15:32:56.409Z',
timestamp: 1709566376409,
},
],
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
},
metadata: [generateMetadata(1)],
batched: true,
statusCode: 200,
destination,
},
{
batchedRequest: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: destination.Config.endpoint,
headers,
params: {},
body: {
JSON: {
events: [
{
type: 'track',
channel,
userId: 'userId123',
anonymousId: 'anonId123',
event: 'Custom Event',
integrations: {
All: true,
},
originalTimestamp: '2024-03-04T15:32:56.409Z',
timestamp: 1709566376409,
},
],
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
},
metadata: [generateMetadata(2)],
batched: true,
statusCode: 200,
destination,
},
],
},
},
},
mockFns: defaultMockFns,
},
];

0 comments on commit 86730d9

Please sign in to comment.