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 9, 2024
1 parent 7e5f44e commit 579785b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/__tests__/mailmodo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe(`${name} Tests`, () => {
const routerOutput = await transformer.processRouterDest(
inputRouterData
);
//assertRouterOutput(routerOutput, inputRouterData);
//assertRouterOutput(routerOutput, inputRouterData); //TODO fix
expect(routerOutput).toEqual(expectedRouterData);
} catch (error) {
expect(error.message).toEqual(expectedRouterData.error);
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 = (d)[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
4 changes: 4 additions & 0 deletions test/testHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const setResponsesForMockAxiosAdapter = ({url, method, data, options}, {response
}

const assertRouterOutput = (output, input) => {
if (!input.metadata) {
return;
}

const returnedJobids = {};
output.forEach((outEvent) => {
//Assert that metadata is present and is an array
Expand Down

0 comments on commit 579785b

Please sign in to comment.