forked from apxtri/apxtri
update unittest
This commit is contained in:
parent
63c604b077
commit
1d40891aee
@ -3,7 +3,6 @@ Unit testing
|
|||||||
*/
|
*/
|
||||||
const assert = require("assert");
|
const assert = require("assert");
|
||||||
const Checkjson = require("../Checkjson.js");
|
const Checkjson = require("../Checkjson.js");
|
||||||
const conf = require(`../../../conf.json`);
|
|
||||||
|
|
||||||
const ut = { name: "Checkjson" };
|
const ut = { name: "Checkjson" };
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@ const assert = require("assert");
|
|||||||
const fs = require("fs-extra");
|
const fs = require("fs-extra");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const Odmdb = require("../Odmdb.js");
|
const Odmdb = require("../Odmdb.js");
|
||||||
const { generemdp } = require("../toolsbox.js");
|
|
||||||
const conf = require(`../../../conf.json`);
|
|
||||||
|
|
||||||
const ut = { name: "Odmdb" };
|
const ut = { name: "Odmdb" };
|
||||||
/*
|
/*
|
||||||
@ -26,8 +25,8 @@ ut.crud = (objectPathname, itm, profils) => {
|
|||||||
const testvar={alias:"tutu", passphrase:"",privatekey:"", publickey:""}
|
const testvar={alias:"tutu", passphrase:"",privatekey:"", publickey:""}
|
||||||
|
|
||||||
const testitms=[
|
const testitms=[
|
||||||
{objectPathname:`../../../adminapi/opjects/pagans`,
|
{objectPathname:`../..//adminapi/opjects/pagans`,
|
||||||
itm:{alias:'toutou', publickey:}}
|
itm:{alias:'toutou', publickey:""}}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
17
unittest.js
17
unittest.js
@ -2,10 +2,6 @@ const fs = require("fs-extra");
|
|||||||
const glob = require("glob");
|
const glob = require("glob");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const process = require("process");
|
const process = require("process");
|
||||||
//const config = require( './tribes/townconf.js' );
|
|
||||||
/*const config = {
|
|
||||||
unittesting: ["middlewares", "models", "routes", "nationchains"],
|
|
||||||
};*/
|
|
||||||
|
|
||||||
global.__base = __dirname + "/";
|
global.__base = __dirname + "/";
|
||||||
const ut = {};
|
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
|
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.
|
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) => {
|
ut.run = (options) => {
|
||||||
if (options.filetotest.length == 0)
|
if (options.filetotest.length == 0)
|
||||||
@ -69,14 +65,15 @@ ut.run = (options) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
//get town conf
|
//get town conf
|
||||||
const infotown = fs.readJsonSync(
|
/*const infotown = fs.readJsonSync(
|
||||||
`${__dirname}/adminapi/www/adminapx/conf/setup_xx.json`
|
`${__dirname}/adminapi/www/adminapx/conf/setup_xx.json`
|
||||||
);
|
);
|
||||||
infotown.dirtown = path.resolve(
|
infotown.dirtown = path.resolve(
|
||||||
`${__dirname}/../${infotown.townId}-${infotown.nationId}`
|
`${__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: [] };
|
const options = { filetotest: [] };
|
||||||
process.argv.slice(2).forEach((arg) => {
|
process.argv.slice(2).forEach((arg) => {
|
||||||
switch (arg.substring(0, 2)) {
|
switch (arg.substring(0, 2)) {
|
||||||
@ -94,7 +91,7 @@ process.argv.slice(2).forEach((arg) => {
|
|||||||
options.active = true;
|
options.active = true;
|
||||||
conf.api.unittesting.forEach((codefolder) => {
|
conf.api.unittesting.forEach((codefolder) => {
|
||||||
glob
|
glob
|
||||||
.sync(`${__dirname}/api/${codefolder}/**/unittest/${arg}.js`)
|
.sync(`../../**/unittest/${arg}.js`)
|
||||||
.forEach((f) => {
|
.forEach((f) => {
|
||||||
if (!options.filetotest.includes(f)) options.filetotest.push(f);
|
if (!options.filetotest.includes(f)) options.filetotest.push(f);
|
||||||
});
|
});
|
||||||
@ -105,7 +102,7 @@ process.argv.slice(2).forEach((arg) => {
|
|||||||
if (!options.active) {
|
if (!options.active) {
|
||||||
conf.api.unittesting.forEach((codefolder) => {
|
conf.api.unittesting.forEach((codefolder) => {
|
||||||
glob
|
glob
|
||||||
.sync(`./${codefolder}/**/unittest/*.js`)
|
.sync(`../../**/unittest/*.js`)
|
||||||
.forEach((f) => {
|
.forEach((f) => {
|
||||||
if (!options.filetotest.includes(f)) options.filetotest.push(f);
|
if (!options.filetotest.includes(f)) options.filetotest.push(f);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user