From 1d40891aee3282f4297402f52bf430093a3a1efb Mon Sep 17 00:00:00 2001 From: philc Date: Mon, 27 May 2024 19:51:28 +0200 Subject: [PATCH] update unittest --- models/unittest/Checkjson.js | 1 - models/unittest/Odmdb.js | 7 +++---- unittest.js | 17 +++++++---------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/models/unittest/Checkjson.js b/models/unittest/Checkjson.js index fb38b8a..080e67c 100644 --- a/models/unittest/Checkjson.js +++ b/models/unittest/Checkjson.js @@ -3,7 +3,6 @@ Unit testing */ const assert = require("assert"); const Checkjson = require("../Checkjson.js"); -const conf = require(`../../../conf.json`); const ut = { name: "Checkjson" }; diff --git a/models/unittest/Odmdb.js b/models/unittest/Odmdb.js index 9baa752..065cbd6 100644 --- a/models/unittest/Odmdb.js +++ b/models/unittest/Odmdb.js @@ -5,8 +5,7 @@ const assert = require("assert"); const fs = require("fs-extra"); const path = require("path"); const Odmdb = require("../Odmdb.js"); -const { generemdp } = require("../toolsbox.js"); -const conf = require(`../../../conf.json`); + const ut = { name: "Odmdb" }; /* @@ -26,8 +25,8 @@ ut.crud = (objectPathname, itm, profils) => { const testvar={alias:"tutu", passphrase:"",privatekey:"", publickey:""} const testitms=[ - {objectPathname:`../../../adminapi/opjects/pagans`, - itm:{alias:'toutou', publickey:}} + {objectPathname:`../..//adminapi/opjects/pagans`, + itm:{alias:'toutou', publickey:""}} ] diff --git a/unittest.js b/unittest.js index d0e4c05..7ae615e 100644 --- a/unittest.js +++ b/unittest.js @@ -2,10 +2,6 @@ const fs = require("fs-extra"); const glob = require("glob"); const path = require("path"); const process = require("process"); -//const config = require( './tribes/townconf.js' ); -/*const config = { - unittesting: ["middlewares", "models", "routes", "nationchains"], -};*/ global.__base = __dirname + "/"; const ut = {}; @@ -43,7 +39,7 @@ To request any update or change in the code add to your git branch a new file in We first run your test and check with git diff your code before merge your branch with your inittest You'll be inform when a new release including your change into apxtri will be available. -\x1b[7mThanks for improving our democracy tool.\x1b[0m +\x1b[7mThanks for improving our tool.\x1b[0m `; ut.run = (options) => { if (options.filetotest.length == 0) @@ -69,14 +65,15 @@ ut.run = (options) => { }); }; //get town conf -const infotown = fs.readJsonSync( +/*const infotown = fs.readJsonSync( `${__dirname}/adminapi/www/adminapx/conf/setup_xx.json` ); infotown.dirtown = path.resolve( `${__dirname}/../${infotown.townId}-${infotown.nationId}` ); -const conf = fs.readJSONSync(`${infotown.dirtown}/conf.json`); -process.env.dirtown = infotown.dirtown; +*/ +const conf = fs.readJSONSync(`../../conf.json`); +//process.env.dirtown = infotown.dirtown; const options = { filetotest: [] }; process.argv.slice(2).forEach((arg) => { switch (arg.substring(0, 2)) { @@ -94,7 +91,7 @@ process.argv.slice(2).forEach((arg) => { options.active = true; conf.api.unittesting.forEach((codefolder) => { glob - .sync(`${__dirname}/api/${codefolder}/**/unittest/${arg}.js`) + .sync(`../../**/unittest/${arg}.js`) .forEach((f) => { if (!options.filetotest.includes(f)) options.filetotest.push(f); }); @@ -105,7 +102,7 @@ process.argv.slice(2).forEach((arg) => { if (!options.active) { conf.api.unittesting.forEach((codefolder) => { glob - .sync(`./${codefolder}/**/unittest/*.js`) + .sync(`../../**/unittest/*.js`) .forEach((f) => { if (!options.filetotest.includes(f)) options.filetotest.push(f); });