Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'title' : 'Root Node',
'description' : 'Root Description',
'children' : ['2'],
},
'2': {
'name' : 'CustomNode',
'title' : 'Node 2',
'description' : 'Node 2 Description'
}
}
};
tree.load(data, {'CustomNode': CustomNode});
// Root
assert.instanceOf(tree.root, Priority);
assert.equal(tree.root.title, 'Root Node');
assert.equal(tree.root.description, 'Root Description');
assert.equal(tree.root.children.length, 1);
// Node 2
var node = tree.root.children[0];
assert.instanceOf(node, CustomNode);
assert.equal(node.title, 'Node 2');
assert.equal(node.description, 'Node 2 Description');
});
const commitRepo = co.wrap(function *(repo,
changes,
doAll,
message,
force,
signature) {
assert.instanceOf(repo, NodeGit.Repository);
assert.isObject(changes);
assert.isBoolean(doAll);
assert.isString(message);
assert.isBoolean(force);
assert.instanceOf(signature, NodeGit.Signature);
const doCommit = 0 !== Object.keys(changes).length || force;
// If we're auto-staging files, loop through workdir and stage them.
if (doAll) {
const index = yield repo.index();
for (let path in changes) {
yield exports.stageChange(index, path, changes[path]);
}
yield index.write();
}
if (doCommit) {
return yield repo.createCommitOnHead(
[],
signature,
it('should register the tests to be invoked later', async () => {
const group = new Group('sample', getFn([]), getFn([]), { bail: false, timeout: 2000 })
group.test('sample test', function cb () {})
assert.lengthOf(group['_tests'], 1)
assert.instanceOf(group['_tests'][0], Test)
})
it('define timeout for the test via group', async () => {
const group = new Group('sample', getFn([]), getFn([]), { bail: false, timeout: 2000 })
group.timeout(300)
const test = group.test('sample test', async function cb () {
await sleep(500)
})
await group.run()
assert.equal(test.toJSON().status, 'failed')
assert.instanceOf(test.toJSON().error, TimeoutException)
})
it('L\'oggetto ritornato ha 3 proprietà, 2 Signal e dispose', function () {
var {onAdded,onRemoved,dispose} = DomWatcher({},()=>{});
assert.instanceOf(onAdded, Signal, "onAdded non è un Signal");
assert.instanceOf(onRemoved, Signal, "onRemoved non è un Signal");
assert.isFunction(dispose, "dispose non è una funzione");
dispose();
});
it('must correct create error object with syscall', () => {
const expectedSysCall = 'queryA';
const error = lookup._makeNotFoundError(addresses.INET_HOST1, expectedSysCall);
assert.instanceOf(error, Error);
assert.strictEqual(error.message, `${expectedSysCall} ${dns.NOTFOUND} ${addresses.INET_HOST1}`);
assert.strictEqual(error.hostname, addresses.INET_HOST1);
assert.strictEqual(error.code, dns.NOTFOUND);
assert.strictEqual(error.errno, dns.NOTFOUND);
assert.strictEqual(error.syscall, expectedSysCall);
});
it('should return Promise', (done) => {
const result = bucket.touchAsync(numKey, 1000);
assert.instanceOf(result, couchbase.Promise);
done();
});
checkResult(done, err, address, family) {
const expectedSysCall = 'queryAaaa';
const expectedCode = 'ENOTFOUND';
const expectedErrNo = 'ENOTFOUND';
const expectedHostName = this.host;
const expectedMessage = `${expectedSysCall} ${expectedErrNo} ${expectedHostName}`;
assert.instanceOf(err, Error);
assert.strictEqual(err.message, expectedMessage);
assert.strictEqual(err.syscall, expectedSysCall);
assert.strictEqual(err.code, expectedCode);
assert.strictEqual(err.errno, expectedErrNo);
assert.strictEqual(err.hostname, expectedHostName);
assert.isUndefined(address);
assert.isUndefined(family);
done();
}
},
beforeParse(window) {
assert.instanceOf(window, window.Window);
assert.instanceOf(window.document, window.Document);
assert.strictEqual(window.document.doctype, null);
assert.strictEqual(window.document.documentElement, null);
assert.strictEqual(window.document.childNodes.length, 0);
windowPassed = window;
}
});