diff --git a/test/__tests__/redis.test.js b/test/__tests__/redis.test.js deleted file mode 100644 index be3a1a497f..0000000000 --- a/test/__tests__/redis.test.js +++ /dev/null @@ -1,28 +0,0 @@ -const integration = "redis"; -const name = "Redis"; - -const fs = require("fs"); -const path = require("path"); -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -inputData.forEach((input, index) => { - it(`${name} Tests: payload - ${index}`, () => { - try { - const output = transformer.process(input); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); -}); diff --git a/test/__tests__/revenue_cat.test.js b/test/__tests__/revenue_cat.test.js deleted file mode 100644 index 8b4487e764..0000000000 --- a/test/__tests__/revenue_cat.test.js +++ /dev/null @@ -1,33 +0,0 @@ -const integration = "revenue_cat"; -const name = "revenue_cat"; - -const fs = require("fs"); -const path = require("path"); -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test Data -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -describe(`${name} Tests`, () => { - describe("Processor Tests", () => { - inputData.forEach((input, index) => { - it(`${name} - payload: ${index}`, async () => { - try { - const output = await transformer.process(input); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); - }); - }); -}); diff --git a/test/__tests__/salesforce.test.js b/test/__tests__/salesforce.test.js deleted file mode 100644 index 7315017376..0000000000 --- a/test/__tests__/salesforce.test.js +++ /dev/null @@ -1,70 +0,0 @@ -jest.mock("axios"); -const integration = "salesforce"; -const name = "Salesforce"; -const version = "v0"; - -const fs = require("fs"); -const path = require("path"); - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test files -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -// Router Test files -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -// Router Metadata Test files -const inputRouterMetadataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_metadata_input.json`) -); -const outputRouterMetadataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_metadata_output.json`) -); -const inputRouterMetadata = JSON.parse(inputRouterMetadataFile); -const expectedRouterMetadata = JSON.parse(outputRouterMetadataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - inputData.forEach(async (input, index) => { - it(`Payload - ${index}`, async () => { - try { - const output = await transformer.process(input); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); - }); - }); - - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); - - describe("Router Metadata Tests", () => { - it("Payload", async () => { - const routerMetadataOutput = await transformer.processMetadataForRouter( - inputRouterMetadata - ); - expect(routerMetadataOutput).toEqual(expectedRouterMetadata); - }); - }); -}); diff --git a/test/__tests__/segment.test.js b/test/__tests__/segment.test.js deleted file mode 100644 index a1f9812f22..0000000000 --- a/test/__tests__/segment.test.js +++ /dev/null @@ -1,33 +0,0 @@ -const integration = "segment"; -const name = "Segment"; - -const fs = require("fs"); -const path = require("path"); -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); -// const { compareJSON } = require("./util"); - -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); - -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -inputData.forEach((input, index) => { - test(`${name} Tests: payload - ${index}`, () => { - let output, expected; - try { - output = transformer.process(input); - expected = expectedData[index]; - } catch (error) { - output = error.message; - expected = expectedData[index].message; - } - expect(output).toEqual(expected); - }); -}); diff --git a/test/__tests__/shynet.test.js b/test/__tests__/shynet.test.js deleted file mode 100644 index b7027d14c3..0000000000 --- a/test/__tests__/shynet.test.js +++ /dev/null @@ -1,29 +0,0 @@ -const integration = "shynet"; -const name = "shynet"; - -const fs = require("fs"); -const path = require("path"); -const version = "v0"; -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test Data -const testDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}.json`) -); -const testData = JSON.parse(testDataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - testData.forEach((dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, async () => { - try { - let output = await transformer.process(dataPoint.input); - delete output.body.JSON.idempotency; - expect(output).toEqual(dataPoint.output); - } catch (error) { - expect(error.message).toEqual(dataPoint.output.error); - } - }); - }); - }); -}); diff --git a/test/__tests__/slack.test.js b/test/__tests__/slack.test.js deleted file mode 100644 index eec0f4054f..0000000000 --- a/test/__tests__/slack.test.js +++ /dev/null @@ -1,48 +0,0 @@ -const integration = "slack"; -const name = "Slack"; - -const fs = require("fs"); -const path = require("path"); - -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); -// const { compareJSON } = require("./util"); - -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -// Router Test Data -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -inputData.forEach((input, index) => { - test(`${name} Tests - payload: ${index}`, () => { - try { - const output = transformer.process(input); - expect(output).toEqual([expectedData[index]]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); -}); -describe(`${name} Tests`, () => { - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); -}); diff --git a/test/__tests__/snapchat_conversion.test.js b/test/__tests__/snapchat_conversion.test.js deleted file mode 100644 index 17fd363cc7..0000000000 --- a/test/__tests__/snapchat_conversion.test.js +++ /dev/null @@ -1,48 +0,0 @@ -const integration = "snapchat_conversion"; -const name = "Snapchat Conversion"; - -const fs = require("fs"); -const path = require("path"); -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test files -const testDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}.json`) -); -const testData = JSON.parse(testDataFile); - -// Router Test files -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -Date.now = jest.fn(() => new Date("2022-04-22T10:57:58Z")); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - testData.forEach((dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, () => { - try { - const output = transformer.process(dataPoint.input); - expect(output).toEqual(dataPoint.output); - } catch (error) { - expect(error.message).toEqual(dataPoint.output.error); - } - }); - }); - }); - - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); -}); diff --git a/test/__tests__/snapchat_custom_audience.test.js b/test/__tests__/snapchat_custom_audience.test.js deleted file mode 100644 index 41c4217562..0000000000 --- a/test/__tests__/snapchat_custom_audience.test.js +++ /dev/null @@ -1,51 +0,0 @@ -const integration = "snapchat_custom_audience"; -const name = "Snapchat Custom Audience"; - -const fs = require("fs"); -const path = require("path"); -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test files -const testDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}.json`) -); -const testData = JSON.parse(testDataFile); - -// Router Test files -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - testData.forEach((dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, async () => { - try { - const output = await transformer.process(dataPoint.input); - expect(output).toEqual(dataPoint.output); - } catch (error) { - expect(error.message).toEqual(dataPoint.output.error); - } - }); - }); - }); - describe("Router", () => { - it("Payload", async () => { - try { - const routerOutput = await transformer.processRouterDest( - inputRouterData - ); - expect(routerOutput).toEqual(expectedRouterData); - } catch (error) { - expect(error.message).toEqual(expectedRouterData.error); - } - }); - }); -}); diff --git a/test/__tests__/splitio.test.js b/test/__tests__/splitio.test.js deleted file mode 100644 index d2b226aea3..0000000000 --- a/test/__tests__/splitio.test.js +++ /dev/null @@ -1,7 +0,0 @@ -const { - getDestFromTestFile, - executeTransformationTest -} = require("./utilities/test-utils"); - -executeTransformationTest(getDestFromTestFile(__filename), "processor"); -executeTransformationTest(getDestFromTestFile(__filename), "router"); diff --git a/test/__tests__/tiktok_ads.test.js b/test/__tests__/tiktok_ads.test.js deleted file mode 100644 index 8b61fabf3d..0000000000 --- a/test/__tests__/tiktok_ads.test.js +++ /dev/null @@ -1,50 +0,0 @@ -const integration = "tiktok_ads"; -const name = "TikTok"; - -const fs = require("fs"); -const path = require("path"); -const version = "v0"; - -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test files -const inputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_input.json`) -); -const outputDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_output.json`) -); -const inputData = JSON.parse(inputDataFile); -const expectedData = JSON.parse(outputDataFile); - -// Router Test files -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - inputData.forEach(async (input, index) => { - it(`Payload - ${index}`, async () => { - try { - const output = await transformer.process(input); - expect(output).toEqual(expectedData[index]); - } catch (error) { - expect(error.message).toEqual(expectedData[index].error); - } - }); - }); - }); - - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); -}); diff --git a/test/__tests__/tiktok_ads_offline_events.test.js b/test/__tests__/tiktok_ads_offline_events.test.js deleted file mode 100644 index 849f73befc..0000000000 --- a/test/__tests__/tiktok_ads_offline_events.test.js +++ /dev/null @@ -1,46 +0,0 @@ -const integration = "tiktok_ads_offline_events"; -const name = "TikTok Ads Offline Events"; - -const fs = require("fs"); -const path = require("path"); - -const version = "v0"; -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test Data -const testDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}.json`) -); -const testData = JSON.parse(testDataFile); - -// Router Test Data -const inputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_input.json`) -); -const outputRouterDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}_router_output.json`) -); -const inputRouterData = JSON.parse(inputRouterDataFile); -const expectedRouterData = JSON.parse(outputRouterDataFile); - -describe(`${name} Tests`, () => { - describe("Processor", () => { - testData.forEach((dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, async () => { - try { - const output = await transformer.process(dataPoint.input); - expect(output).toEqual(dataPoint.output); - } catch (error) { - expect(error.message).toEqual(dataPoint.output.error); - } - }); - }); - }); - - describe("Router Tests", () => { - it("Payload", async () => { - const routerOutput = await transformer.processRouterDest(inputRouterData); - expect(routerOutput).toEqual(expectedRouterData); - }); - }); -}); diff --git a/test/__tests__/twitter_ads.test.js b/test/__tests__/twitter_ads.test.js deleted file mode 100644 index 08811aad52..0000000000 --- a/test/__tests__/twitter_ads.test.js +++ /dev/null @@ -1,44 +0,0 @@ -const integration = "twitter_ads"; -const name = "twitter_ads"; - -const fs = require("fs"); -const path = require("path"); - -const version = "v0"; -const transformer = require(`../../src/${version}/destinations/${integration}/transform`); - -// Processor Test Data -const testDataFile = fs.readFileSync( - path.resolve(__dirname, `./data/${integration}.json`) -); -const testData = JSON.parse(testDataFile); - -const authHeaderConstant = "OAuth oauth_consumer_key=\"qwe\", oauth_nonce=\"V1kMh028kZLLhfeYozuL0B45Pcx6LvuW\", oauth_signature=\"Di4cuoGv4PnCMMEeqfWTcqhvdwc%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1685603652\", oauth_token=\"dummyAccessToken\", oauth_version=\"1.0\""; - -jest.mock("../../src/v0/destinations/twitter_ads/util", () => { - const originalModule = jest.requireActual("../../src/v0/destinations/twitter_ads/util"); - return { - ...originalModule, - getAuthHeaderForRequest: jest.fn(() => { - return { - Authorization: authHeaderConstant - } - }) - } -}) - -describe(`${name} Tests`, () => { - describe("Processor", () => { - testData.forEach((dataPoint, index) => { - it(`${index}. ${integration} - ${dataPoint.description}`, async () => { - try { - let output = await transformer.process(dataPoint.input); - delete output.body.JSON.idempotency; - expect(output).toEqual(dataPoint.output); - } catch (error) { - expect(error.message).toEqual(dataPoint.output.error); - } - }); - }); - }); -}); diff --git a/test/__tests__/variance.test.js b/test/__tests__/variance.test.js deleted file mode 100644 index ac6e247191..0000000000 --- a/test/__tests__/variance.test.js +++ /dev/null @@ -1,3 +0,0 @@ -const { executeTransformationTest } = require("./utilities/test-utils"); - -executeTransformationTest("variance", "processor");