Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should error if no parameters passed', function(done) {
// arrange
var caughtErr;
// act
try {
ternaryStream();
} catch (err) {
caughtErr = err;
}
// assert
should.exist(caughtErr);
caughtErr.message.indexOf('required').should.be.above(-1);
done();
});
setTimeout(function () {
// assert
should.exist(task.err);
task.err.should.equal(expectedErr);
should.exist(task.runMethod);
task.runMethod.should.equal(expectedRunMethod);
a.should.equal(2); // task, run callback
done();
}, taskTimeout*2);
});
doneOnce.run(args, function (/*err*/) {
// assert
should.exist(task.err);
task.err.should.equal(expectedErr);
done();
});
});
it( 'creates a query folder', function( done ) {
testFolder = null;
should.exist( testProject );
should.exist( myQueries );
client.createFolder( testProject.name, 'testFolder1', myQueries.id, function( err, folder ) {
should.not.exist( err );
should.exist( folder );
// console.log(folder);
folder.should.have.property( 'id' );
folder.should.have.property( 'url' );
testFolder = folder;
done();
} );
} );
it('calls back with error indicating the mistake', function () {
should.exist(error);
error.toString().should.include('post.json doesn\'t exist');
})
})
function extract_value_for_field(fieldName, result) {
should.exist(result);
var index = fields.indexOf(fieldName);
should(index >= 0, " cannot find fieldName in list : fiedName =" + fieldName + " list: " + fields.join(" "));
return result[index];
}
cb.error = function(code) {
called.should.equal(1)
should.exist(err)
err.should.have.property('code').equal(code)
}
}).then((resp) => {
users = resp;
should.exist(users);
const supervisorsUrl = `/org/departments/${department.department_id}/supervisors`;
owner.get(supervisorsUrl)
.expect(200)
.end((err, res) => {
users.forEach((user) => {
const lastFirst = `${user.last}, ${user.first}`;
res.text.should.match(RegExp(lastFirst));
});
done(err);
});
}).catch(done);
});
function convertOneResultFunction(module, callback) {
should.exist(callback);
return function crs(err, pgResult) {
if (err) return callback(err);
if (pgResult.rows.length === 0) return callback(null, null);
const row = pgResult.rows[0];
var r = module.create();
for (var k in row.data) {
r[k] = row.data[k];
}
r.id = row.id;
return callback(null, r);
};
}
function convertResultFunction(module, callback) {
should.exist(callback);
return function crs(err, pgResult) {
const result = [];
if (err) return callback(err);
pgResult.rows.forEach(function(row) {
var r = module.create();
for (var k in row.data) {
r[k] = row.data[k];
}
r.id = row.id;
result.push(r);
});
return callback(null, result);
};
}