Skip to content

Commit

Permalink
chore: rt_batch_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandra shekar Varkala committed Jan 22, 2024
1 parent 3741073 commit 82d3e8f
Show file tree
Hide file tree
Showing 141 changed files with 19,782 additions and 31,011 deletions.
30 changes: 20 additions & 10 deletions test/__tests__/data/pinterest_tag_router_batch_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@
},
"metadata": [
{
"jobId": 1
"jobId": 1,
"userId": "u1"
},
{
"jobId": 2
"jobId": 2,
"userId": "u1"
}
],
"batched": true,
Expand Down Expand Up @@ -329,13 +331,16 @@
},
"metadata": [
{
"jobId": 3
"jobId": 3,
"userId": "u1"
},
{
"jobId": 4
"jobId": 4,
"userId": "u1"
},
{
"jobId": 6
"jobId": 6,
"userId": "u1"
}
],
"batched": true,
Expand Down Expand Up @@ -445,7 +450,8 @@
},
"metadata": [
{
"jobId": 7
"jobId": 7,
"userId": "u1"
}
],
"batched": true,
Expand Down Expand Up @@ -496,7 +502,8 @@
{
"metadata": [
{
"jobId": 5
"jobId": 5,
"userId": "u1"
}
],
"batched": false,
Expand Down Expand Up @@ -736,10 +743,12 @@
},
"metadata": [
{
"jobId": 8
"jobId": 8,
"userId": "u1"
},
{
"jobId": 9
"jobId": 9,
"userId": "u1"
}
],
"statusCode": 200
Expand Down Expand Up @@ -852,7 +861,8 @@
},
"metadata": [
{
"jobId": 10
"jobId": 10,
"userId": "u1"
}
],
"statusCode": 200
Expand Down
3 changes: 2 additions & 1 deletion test/__tests__/data/pinterest_tag_router_error_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
}
},
"metadata": {
"jobId": 5
"jobId": 5,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down
3 changes: 2 additions & 1 deletion test/__tests__/data/pinterest_tag_router_error_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{
"metadata": [
{
"jobId": 5
"jobId": 5,
"userId": "u1"
}
],
"batched": false,
Expand Down
30 changes: 20 additions & 10 deletions test/__tests__/data/pinterest_tag_router_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
}
},
"metadata": {
"jobId": 1
"jobId": 1,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -198,7 +199,8 @@
}
},
"metadata": {
"jobId": 2
"jobId": 2,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -300,7 +302,8 @@
}
},
"metadata": {
"jobId": 3
"jobId": 3,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -421,7 +424,8 @@
}
},
"metadata": {
"jobId": 4
"jobId": 4,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -542,7 +546,8 @@
}
},
"metadata": {
"jobId": 5
"jobId": 5,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -663,7 +668,8 @@
}
},
"metadata": {
"jobId": 6
"jobId": 6,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -764,7 +770,8 @@
"files": {}
},
"metadata": {
"jobId": 7
"jobId": 7,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -888,7 +895,8 @@
}
},
"metadata": {
"jobId": 8
"jobId": 8,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -1011,7 +1019,8 @@
}
},
"metadata": {
"jobId": 9
"jobId": 9,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down Expand Up @@ -1134,7 +1143,8 @@
}
},
"metadata": {
"jobId": 10
"jobId": 10,
"userId": "u1"
},
"destination": {
"ID": "1pYpzzvcn7AQ2W9GGIAZSsN6Mfq",
Expand Down
30 changes: 20 additions & 10 deletions test/__tests__/data/pinterest_tag_router_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,22 +294,28 @@
},
"metadata": [
{
"jobId": 1
"jobId": 1,
"userId": "u1"
},
{
"jobId": 2
"jobId": 2,
"userId": "u1"
},
{
"jobId": 3
"jobId": 3,
"userId": "u1"
},
{
"jobId": 4
"jobId": 4,
"userId": "u1"
},
{
"jobId": 6
"jobId": 6,
"userId": "u1"
},
{
"jobId": 7
"jobId": 7,
"userId": "u1"
}
],
"batched": true,
Expand Down Expand Up @@ -360,7 +366,8 @@
{
"metadata": [
{
"jobId": 5
"jobId": 5,
"userId": "u1"
}
],
"statTags": {
Expand Down Expand Up @@ -593,13 +600,16 @@
},
"metadata": [
{
"jobId": 8
"jobId": 8,
"userId": "u1"
},
{
"jobId": 9
"jobId": 9,
"userId": "u1"
},
{
"jobId": 10
"jobId": 10,
"userId": "u1"
}
],
"batched": true,
Expand Down
3 changes: 3 additions & 0 deletions test/__tests__/pinterestConversion.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const path = require("path");
const version = "v0";

const transformer = require(`../../src/${version}/destinations/${integration}/transform`);
const { assertRouterOutput } = require('../testHelper');

const inputDataFile = fs.readFileSync(
path.resolve(__dirname, `./data/${integration}_input.json`)
);
Expand Down Expand Up @@ -44,6 +46,7 @@ describe(`${name} Tests`, () => {
inputRouterData.forEach((input, index) => {
it(`Payload: ${index}`, async () => {
let output = await transformer.processRouterDest(input);
assertRouterOutput(output, input);
expect(output).toEqual(expectedRouterData[index]);
});
});
Expand Down
6 changes: 5 additions & 1 deletion test/__tests__/utilities/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const fs = require("fs");
const _ = require("lodash");
const path = require("path");
const { ConfigFactory, Executor } = require("rudder-transformer-cdk");
const { assertRouterOutput } = require('../../testHelper');

// TODO: separate this out later as the list grows
const cdkEnabledDestinations = {
Expand Down Expand Up @@ -95,7 +96,9 @@ function executeTransformationTest(dest, transformAt) {
if (transformAt == "processor") {
actualData = await transformer.process(tcInput);
} else {
actualData = (await transformer.processRouterDest([tcInput]))[0];
actual = await transformer.processRouterDest([tcInput])
assertRouterOutput(actual, [tcInput]);
actualData = (actual)[0];
}
}
// Compare actual and expected data
Expand All @@ -115,6 +118,7 @@ function executeTransformationTest(dest, transformAt) {
const version = "v0";
const transformer = require(`../../../src/${version}/destinations/${dest}/transform`);
actualData = await transformer.processRouterDest(commonInput);
assertRouterOutput(actualData, commonInput);
const cloneActual = _.cloneDeep(actualData);
cloneActual[0].statTags = "undefined";
// Compare actual and expected data
Expand Down
17 changes: 16 additions & 1 deletion test/integrations/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import tags from '../../src/v0/util/tags';
import { Server } from 'http';
import { appendFileSync } from 'fs';
import { responses } from '../testHelper';
import { assertRouterOutput, responses } from '../testHelper';
import { generateTestReport, initaliseReport } from '../test_reporter/reporter';
import _ from 'lodash';

Expand Down Expand Up @@ -128,6 +128,21 @@ const testRoute = async (route, tcData: TestCaseData) => {
.query(params || {})
.send(body);
const outputResp = tcData.output.response || ({} as any);

if (tcData.feature === tags.FEATURES.BATCH || tcData.feature === tags.FEATURES.ROUTER) {
//TODO get rid of these skipped destinations after they are fixed
if (
tcData.name != 'marketo_static_list' &&
tcData.name != 'mailmodo' &&
tcData.name != 'hs' &&
tcData.name != 'iterable' &&
tcData.name != 'klaviyo' &&
tcData.name != 'google_adwords_offline_conversions'
) {
assertRouterOutput(response.body.output, tcData.input.request.body.input);
}
}

expect(response.status).toEqual(outputResp.status);

if (REPORT_COMPATIBLE_INTEGRATION.includes(tcData.name?.toLocaleLowerCase())) {
Expand Down
Loading

0 comments on commit 82d3e8f

Please sign in to comment.