it('should allow stream.path that can not be parsed', function test() { const stream = fs.createReadStream(paths.audio); stream.path = '/?id=123'; // for example, 'http://example.com/?id=666' assert.doesNotThrow(function assertDoesNotThrow() { bot._formatSendData('file', stream); }); });
tom.test('.renderSync({ files })', function () { Fixture.createTmpFolder('tmp') Fixture.createTmpFolder('tmp/renderSync') const f = new Fixture('class-all') jsdoc.renderSync({ files: f.sourcePath, destination: 'tmp/renderSync/out' }) a.doesNotThrow(function () { fs.statSync('./tmp/renderSync/out/index.html') }) })
function test() { assert.throws(mightThrow.bind(null), 'should throw on empty parameter'); assert.doesNotThrow( mightThrow.bind(null, 'some-value'), 'should not throw if not empty' ); assert.deepStrictEqual( mightThrow('some-value'), 'some-value', 'should return input if set' ); }
describe('validateData', () => { it('should throw an error if data contains /', () => { assert.throws(() => validateData({ 'a/b': [] }), /found \//) }) it('should throw an error if data is an array', () => { assert.throws(() => validateData([]), /must be an object/) }) it("shouldn't throw an error", () => { assert.doesNotThrow(() => validateData({ a: [] })) }) })
server.listen(common.fakeServerPort, function (err) { assert.ifError(err); pool.getConnection(function (err, connection) { assert.ifError(err); assert.strictEqual(connection, pool._manager._allConnection.get(connection.getId())); connection.destroy(); assert.equal(pool.getStatus().all, 0); assert.equal(connection._pool, null); assert.doesNotThrow(function () { connection.release(); }); server.destroy(); }); });
test('creates context file if none exist', function() { assert.doesNotThrow(function() { logger.setUp(); }); assert.equal(logger.data, '', 'sets data to blank'); });
assert.doesNotThrow(() => { myProduct.category = 'condiments'; }, 'writing to an existing property is fine in non strict mode');
describe('JSON Validator', function() { describe('twitter.json', function() { it('should contain valid JSON', function(){ assert.doesNotThrow(() => JSON.parse(fs.readFileSync('./_data/twitter.json', 'utf8'))); }); }); describe('metamaskImports.json', function() { it('should contain valid JSON', function(){ assert.doesNotThrow(() => JSON.parse(fs.readFileSync('./_data/metamaskImports.json', 'utf8'))); }); }); });
describe('start', () => { it('should make the correct API request', done => { vm.request = function(reqOpts, callback) { assert.strictEqual(reqOpts.method, 'POST'); assert.strictEqual(reqOpts.uri, '/start'); callback(); }; vm.start(done); }); it('should not require a callback', done => { vm.request = function(reqOpts, callback) { assert.doesNotThrow(() => { callback(); done(); }); }; vm.start(); }); });
tom.test('.renderSync({ source, destination })', function () { Fixture.createTmpFolder('tmp') Fixture.createTmpFolder('tmp/renderSync') const f = new Fixture('class-all') jsdoc.renderSync({ source: f.getSource(), destination: 'tmp/renderSync/out' }) a.doesNotThrow(function () { fs.statSync('./tmp/renderSync/out/index.html') }) })
describe('stop', () => { it('should make the correct API request', done => { vm.request = function(reqOpts, callback) { assert.strictEqual(reqOpts.method, 'POST'); assert.strictEqual(reqOpts.uri, '/stop'); callback(); }; vm.stop(done); }); it('should not require a callback', done => { vm.request = function(reqOpts, callback) { assert.doesNotThrow(() => { callback(); done(); }); }; vm.stop(); }); });
describe('delete', () => { it('should make the correct API request', done => { vm.request = function(reqOpts, callback) { assert.strictEqual(reqOpts.method, 'DELETE'); assert.strictEqual(reqOpts.uri, ''); callback(); }; vm.delete(done); }); it('should not require a callback', done => { vm.request = function(reqOpts, callback) { assert.doesNotThrow(() => { callback(); done(); }); }; vm.delete(); }); });
describe('reset', () => { it('should make the correct API request', done => { vm.request = function(reqOpts, callback) { assert.strictEqual(reqOpts.method, 'POST'); assert.strictEqual(reqOpts.uri, '/reset'); callback(); }; vm.reset(done); }); it('should not require a callback', done => { vm.request = function(reqOpts, callback) { assert.doesNotThrow(() => { callback(); done(); }); }; vm.reset(); }); });
test('creates store file if none exist', function() { assert.doesNotThrow(function() { guard.setUp(); }); assert.equal(guard.data, '', 'sets data to blank'); });
assert.doesNotThrow(() => { myProduct.name = 'Super Special Sauce'; }, 'writing a new property is fine in non strict mode');