1
0
forked from apxtri/apxtri

update unittest

This commit is contained in:
philc 2024-05-27 19:51:28 +02:00
parent 63c604b077
commit 1d40891aee
3 changed files with 10 additions and 15 deletions

View File

@ -3,7 +3,6 @@ Unit testing
*/
const assert = require("assert");
const Checkjson = require("../Checkjson.js");
const conf = require(`../../../conf.json`);
const ut = { name: "Checkjson" };

View File

@ -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:""}}
]

View File

@ -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);
});