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 override with environment values', function() {
process.env.TARGET_ENV = "test";
// Invalidate cached config module so we can load it again with new TARGET_ENV
delete require.cache[require.resolve(CONFIG_MODULE_FILE_NAME)];
const subject = require(CONFIG_MODULE_FILE_NAME);
checkDefaults(subject);
assert.equal(subject.environmentName, "Test");
});
});
verifyReset.create({ action: 'resend', value: email }, {}, (err, user) => {
assert.strictEqual(err, null, 'err code set');
// Check user record modified as expected
assert.strictEqual(user.isVerified, false, 'isVerified not false');
assert.isString(user.verifyToken, 'verifyToken not String');
assert.equal(user.verifyToken.length, 30, 'verify token wrong length');
aboutEqualDateTime(user.verifyExpires, makeDateTime());
// Check database record is identical
assert.deepEqual(user, db[0]);
done();
});
});
it('min', () => {
const binaryThree = new BinaryThree();
binaryThree.add(1);
binaryThree.add(5);
binaryThree.add(4);
binaryThree.add(6);
binaryThree.add(3);
assets.equal(binaryThree.min(), 1);
});
it("process() : kr", function() {
var sin = T("cell.sin");
var pulse = T("cell.pulse", {mul:0.25});
var tri = T("cell.tri");
var t = T("max", sin, pulse, tri).kr();
var val, cell = t.process(0);
val = Math.max(sin.cell[0], Math.max(pulse.cell[0], tri.cell[0]));
assert.closeTo(cell[0], val, 1e-6);
for (var i = 1, imax = cell.length; i < imax; ++i) {
assert.equal(cell[0], cell[i]);
}
});
});
it('should read !! as !', async function () {
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, 'convos', 'convos_with!!.xlsx'))
const context = buildContext()
const caps = {
}
const compiler = new Compiler(context, Object.assign({}, DefaultCapabilities, caps))
compiler.Compile(scriptBuffer, 'SCRIPTING_TYPE_CONVO')
assert.equal(context.convos[0].conversation[1].messageText, '!test 2')
assert.equal(context.convos[0].conversation[1].not, false)
})
it('should read n*! as (n-1)*!', async function () {
it('initialised pool correctly', () => {
assert.equal(initialisePool.callCount, 1)
const args = initialisePool.args[0]
assert.equal(args.length, 2)
assert.equal(args[0], config)
assert.equal(args[1], log)
})
dtable.once("open", () => {
assert.equal(dtable._name, "bar");
assert.equal(dtable._path, "data/bar_DATA.SNAP");
assert.equal(dtable._tmpDumpPath, "data/bar_DATA_PREV.SNAP");
assert.equal(dtable._aofPath, "data/bar_LATEST.LOG");
assert.equal(dtable._tmpAOFPath, "data/bar_PREV.LOG");
assert.isString(dtable._id);
assert.isNumber(dtable._fd);
assert.ok(dtable._idleInterval);
assert.ok(dtable._syncInterval);
assert.ok(dtable._fstream);
done();
});
});
return fn(req, res).then(() => {
assert.isOk(req)
assert.equal(res.statusCode, 200)
assert.equal(res._getData(), 'Action undefined. The secret password of undefined is undefined')
})
})))
upstream.request({uri: '/', method: 'POST', data: 'some data here', attemptLimit: 1}, function(err) {
assert.ok(err);
assert.equal(err.message, 'Too many retries');
done();
});
});
db.info( '123', function(err, obj){
assert.equal(err, null);
assert.equal(obj.maxRetention, 3600);
assert.equal(obj.xFilesFactor, 0.5);
assert.equal(obj.archives.length, 1);
done();
});
});