mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-25 00:23:12 +09:00
researchSync: Tried to avoid errors when research doesn't exist
This commit is contained in:
1 parent
7a4ea69cbb
commit
c8f2a67845
3 files changed
+51
-5
No files matched your search
@@ -0,0 +1,34 @@
|
||||
const assert = require("assert");
|
||||
|
||||
const researchSync = require("./index.js");
|
||||
|
||||
describe("researchSync/index.js", ()=>{
|
||||
it("exports a single class (or at least a function)", ()=>{
|
||||
assert.equal(typeof researchSync, "function");
|
||||
});
|
||||
describe("class researchSync()", ()=>{
|
||||
it(".diff(object1, object2) returns key:value pairs that exist in object2 but not object1", ()=>{
|
||||
let reSync = new researchSync();
|
||||
|
||||
let obj1 = {
|
||||
a:"str",
|
||||
b:123,
|
||||
c:console.log,
|
||||
d:"apple cake",
|
||||
}
|
||||
let obj2 = {
|
||||
a:"str",
|
||||
b:9999,
|
||||
c:console.log,
|
||||
e:"truthy",
|
||||
}
|
||||
assert(typeof reSync.diff == "function");
|
||||
|
||||
let diffResult = reSync.diff(obj1, obj2);
|
||||
assert(diffResult.a === undefined);
|
||||
assert(diffResult.b === 9999);
|
||||
assert(diffResult.d === undefined);
|
||||
assert(diffResult.e === "truthy");
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user