assert.doesNotThrow(function () { throw new Error('bang!') })
assert.doesNotThrow(function () {})
it('notifyUI: throws error if socket closed or not authenticated', () => { ws = createTestWSv2Instance() const n = { type: 'info', message: 'test' } assert.throws(() => ws.notifyUI(n)) ws._isOpen = true assert.throws(() => ws.notifyUI(n)) ws._isAuthenticated = true ws.send = () => {} assert.doesNotThrow(() => ws.notifyUI(n)) })
describe("run.js", function() { it("should exist", function() { assert.doesNotThrow(function() { fs.accessSync(`${boxDir}/run.js`, fs.F_OK); }); }); it("should display a help text when no files are passed", function(done) { exec(boxCommand, function(err, stdout) { assert.strictEqual(err, null); assert(stdout.includes("Usage:")); done(); }); }); it("should run on a blank script", function(done) { const path = `${tmpDir}/blank.js`; fs.writeFileSync(`${tmpDir}/blank.js`, ""); exec(`${boxCommand} ${path}`, done); }); it("should run on all files in a folder"); it("should accept several paths"); });
it('check term frequency', () => { let c1; let c2; let c3; let c4; let c5; assert.doesNotThrow(() => { c1 = Contract.create({ begin: '01/01/2017 00:00', end: '01/01/2017 03:00', frequency: 'hours', properties: [{}, {}]}); c2 = Contract.create({ begin: '01/01/2017 00:00', end: '31/01/2017 23:59', frequency: 'days', properties: [{}, {}]}); c3 = Contract.create({ begin: '01/01/2017 00:00', end: '14/01/2017 23:59', frequency: 'weeks', properties: [{}, {}]}); c4 = Contract.create({ begin: '01/01/2017 00:00', end: '31/12/2017 23:59', frequency: 'months', properties: [{}, {}]}); c5 = Contract.create({ begin: '01/01/2017 00:00', end: '31/12/2025 23:59', frequency: 'years', properties: [{}, {}]}); }); assert.strictEqual(c1.terms, 3, 'incorrect number of terms'); assert.strictEqual(c2.terms, 31, 'incorrect number of terms'); assert.strictEqual(c3.terms, 2, 'incorrect number of terms'); assert.strictEqual(c4.terms, 12, 'incorrect number of terms'); assert.strictEqual(c5.terms, 9, 'incorrect number of terms'); assert.throws(() => { Contract.create({ begin: '01/01/2017 00:00', end: '01/01/2017 03:00', frequency: 'blabla', properties: [{}, {}]}); }); });
assert.doesNotThrow(function () { agent.start(TARGET_IP, {type: 'icmp'}); }); }); assert.doesNotThrow(function () { agent.stop(); }); });
assert.doesNotThrow(function() { var d = new Date(); d.toUTCString = null; util.inspect(d); });
assert.doesNotThrow( () => { floodController.startFlood(TARGET_IP, {type: 'icmp'}) assert.doesNotThrow( () => { floodController.stopFlood();
assert.doesNotThrow(function() { var r = /regexp/; r.toString = null; util.inspect(r); });
assert.doesNotThrow(function() { util.inspect([{inspect: function() { return 123; }}]); });
assert.doesNotThrow(function() { util.inspect({hasOwnProperty: null}); });