diff --git a/test/private_separator.test.js b/test/private_separator.test.js index 0eae462..cead203 100644 --- a/test/private_separator.test.js +++ b/test/private_separator.test.js @@ -5,7 +5,7 @@ const test = async (doLog) => { const linkFile = "./simple_complexe.csv"; const link = path.join(__dirname, linkFile); if (doLog != false) { - console.log(`- Custom Separator - ${path.basename(__filename)} - "${linkFile}"`); + console.log(`- Private Separator - ${path.basename(__filename)} - "${linkFile}"`); } const schema = { num4: { @@ -20,7 +20,7 @@ const test = async (doLog) => { }; // with normal separator, "num1..." will be not displayed return parseFile(link, schema, { - debug: "hi", + debug: true, privateSeparator: "#" // we change the privateSeparator other thing (it can be any string) }); }; diff --git a/test/private_separator_2.test.js b/test/private_separator_2.test.js new file mode 100644 index 0000000..2ad1d7c --- /dev/null +++ b/test/private_separator_2.test.js @@ -0,0 +1,57 @@ +const parseFile = require("../index"); +const path = require("path"); + +const test = async (doLog) => { + const linkFile = "./simple_complexe.csv"; + const link = path.join(__dirname, linkFile); + if (doLog != false) { + console.log(`- Private Separator - ${path.basename(__filename)} - "${linkFile}"`); + } + const schema = { + num4: { + num1: "string", + "num1...": "string", + num2: "string", + num3: "int", + hello4: (value) => { + return `The number 4 is ${value}`; + } + } + }; + // with normal separator, "num1..." will be not displayed + return parseFile(link, schema, { + debug: true, + }); +}; + +const result = [ + { + "num4": { + "num1": "1", + "num2": "2", + "num3": 3, + "hello4": "The number 4 is 1,2,3,4" + } + }, + { + "num4": { + "num1": "4", + "num2": "5", + "num3": 6, + "hello4": "The number 4 is 4,5,6,7" + } + }, + { + "num4": { + "num1": "7", + "num2": "8", + "num3": 9, + "hello4": "The number 4 is 7,8,9,10" + } + } +]; + +module.exports = { + test, + result +} \ No newline at end of file diff --git a/test/test.js b/test/test.js index 1c88b10..21410df 100644 --- a/test/test.js +++ b/test/test.js @@ -13,7 +13,7 @@ const test = async () => { doLog = false; } if (args.length > 0) { - console.log(args); + // console.log(args); listOfFiles = []; for (const oneArg of args) { if (!oneArg.startsWith("-")) {