-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5644203
commit ed03148
Showing
2 changed files
with
54 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,55 @@ | ||
const integration = "af"; | ||
const name = "AppsFlyer"; | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const version = "v0"; | ||
|
||
const transformer = require(`../${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); | ||
|
||
// 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 { | ||
// ignored | ||
const output = transformer.process(input); | ||
expect(output).toEqual(expectedData[index]); | ||
} catch (error) { | ||
expect(error.message).toEqual(expectedData[index].error); | ||
} | ||
}); | ||
// const integration = "af"; | ||
// const name = "AppsFlyer"; | ||
// const fs = require("fs"); | ||
// const path = require("path"); | ||
// const version = "v0"; | ||
|
||
// const transformer = require(`../${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); | ||
|
||
// // 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 { | ||
// // ignored | ||
// 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); | ||
// }); | ||
// }); | ||
|
||
// }); | ||
|
||
describe(`${name} Tests`, () => { | ||
const { getDestFromTestFile, executeTransformationTest } = require("./utilities/test-utils"); | ||
|
||
describe("Router Tests", () => { | ||
it("Payload", async () => { | ||
const routerOutput = await transformer.processRouterDest(inputRouterData); | ||
expect(routerOutput).toEqual(expectedRouterData); | ||
}); | ||
}); | ||
executeTransformationTest('af','processor') | ||
executeTransformationTest('af','router') | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters