apxtrib/api/models/unittest/Odmdb.js

44 lines
890 B
JavaScript
Raw Normal View History

2023-04-13 05:46:35 +00:00
/*
Unit testing
*/
const assert = require("assert");
2023-11-05 11:03:25 +00:00
const fs = require("fs-extra");
const path = require("path");
2023-04-13 05:46:35 +00:00
const Odmdb = require("../Odmdb.js");
2023-11-05 11:03:25 +00:00
const { generemdp } = require("../toolsbox.js");
const conf = require(`${process.env.dirtown}/conf.json`);
2023-04-13 05:46:35 +00:00
const ut = { name: "Odmdb" };
/*
2023-11-05 11:03:25 +00:00
Test crud process for any object
2023-04-13 05:46:35 +00:00
*/
2023-11-05 11:03:25 +00:00
ut.crud = (objectPathname, itm, profils) => {
//
// test if exist
// if not test create
// test to read
// test update
// test delete
const res = { status: 200, err: [] };
return res;
};
const testvar={alias:"tutu", passphrase:"",privatekey:"", publickey:""}
2023-04-13 05:46:35 +00:00
2023-11-05 11:03:25 +00:00
const testitms=[
{objectPathname:`${conf.dirapi}/nationchains/pagans`,
itm:{alias:'toutou', publickey:}}
]
2023-04-13 05:46:35 +00:00
2023-11-05 11:03:25 +00:00
ut.run = (options) => {
let msg=""
testitms.forEach(i=>{
ut.crud(i)
//si erreur add msg+++
})
assert.deepEqual(msg, "", msg);
};
module.exports = ut;