keep a parallel implementation of the pin loader to validate the new one

This commit is contained in:
ansuz
2020-04-07 20:03:41 -04:00
parent dca2707ae3
commit 95965c1dee
3 changed files with 106 additions and 1 deletions

View File

@@ -0,0 +1,42 @@
/* 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();

View File

@@ -42,7 +42,7 @@ nThen(function (w) {
store = _;
})); // load the list of pinned files so you know which files
// should not be archived or deleted
Pins.list(w(function (err, _) {
Pins.load(w(function (err, _) {
if (err) {
w.abort();
return void console.error(err);