You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1022 B
JavaScript
43 lines
1022 B
JavaScript
5 years ago
|
/* jshint esversion: 6, node: true */
|
||
|
const nThen = require("nthen");
|
||
|
const Pins = require("../lib/pins");
|
||
|
const Assert = require("assert");
|
||
|
|
||
|
const config = require("../lib/load-config");
|
||
|
|
||
|
var compare = function () {
|
||
|
console.log(config);
|
||
|
var conf = {
|
||
|
pinPath: config.pinPath,
|
||
|
};
|
||
|
|
||
|
var list, load;
|
||
|
|
||
|
nThen(function (w) {
|
||
|
Pins.list(w(function (err, p) {
|
||
|
if (err) { throw err; }
|
||
|
list = p;
|
||
|
console.log(p);
|
||
|
console.log(list);
|
||
|
console.log();
|
||
|
}), conf);
|
||
|
}).nThen(function (w) {
|
||
|
Pins.load(w(function (err, p) {
|
||
|
if (err) { throw err; }
|
||
|
load = p;
|
||
|
console.log(load);
|
||
|
console.log();
|
||
|
}), conf);
|
||
|
}).nThen(function () {
|
||
|
console.log({
|
||
|
listLength: Object.keys(list).length,
|
||
|
loadLength: Object.keys(load).length,
|
||
|
});
|
||
|
|
||
|
Assert.deepEqual(list, load);
|
||
|
console.log("methods are equivalent");
|
||
|
});
|
||
|
};
|
||
|
|
||
|
compare();
|