expect(Math.abs(heapDiff.change.size_bytes)).to.be.below(1024) result.printSummary('async no-op function') for (const heapDiff of result.heapDiffs) { expect(Math.abs(heapDiff.change.size_bytes)).to.be.below(17 * 1024) result.printSummary('async deferred no-op function') for (const heapDiff of result.heapDiffs) { expect(Math.abs(heapDiff.change.size_bytes)).to.be.below(24 * 1024)
it('should report error when the resetToken is expired', async () => { const expiredPasswordResetTokenObj = await PasswordResetToken.create(expiredResetToken); expect(expiredPasswordResetTokenObj.resetToken).to.be.equal('5947397b323ae82d8c3a333b.c69d0435e62c9f4953af912442a3d064e20291f0d228c0552ed4be473e7d191ba40b18c2c47e8b9d'); expect(expiredPasswordResetTokenObj.userId.toString()).to.be.equal('5947397b323ae82d8c3a333b'); expect(expiredPasswordResetTokenObj.userEmail).to.be.equal(dbUser.email); expect(expiredPasswordResetTokenObj.expires).to.be.below(moment().toDate()); return request(app) .post('/v1/auth/reset-password') .send({ email: dbUser.email, password: 'updated password', resetToken: expiredResetToken.resetToken, }) .expect(httpStatus.UNAUTHORIZED) .then((res) => { expect(res.body.code).to.be.equal(401); expect(res.body.message).to.include('Reset token is expired'); }); });
it("should generate a valid number within exclusive min/max", () => { let schema = new JsonSchema({ type: "integer", minimum: 1, maximum: 10, exclusiveMinimum: true, exclusiveMaximum: true }); for (let i = 0; i < iterations; i++) { expect(schema.sample()) .to.be.a("number") .and.satisfy(Number.isFinite) .and.satisfy(isWholeNumber) .and.above(1) .and.below(10); } });
expect(() => { expect(null, "blah").to.be.below(0); }, "blah: expected null to be a number or a date");
it("Get total of routes", function () { this.timeout(5000); var page = 1; return CloudFoundryRoutes.getRoutes(page).then(function (result) { console.log(result.total_results); expect(result.total_results).to.be.below(1001); }); });
expect(() => { expect(null).to.be.below(0, "blah"); }).to.throw(AssertionError, "blah: expected null to be a number or a date");
it('using orderBy == "height:asc" should be ok', function (done) { getBlocks('orderBy=' + 'height:asc', function (err, res) { node.expect(res.body).to.have.property('success').to.be.ok; node.expect(res.body).to.have.property('blocks').that.is.an('array'); for (var i = 0; i < res.body.blocks.length; i++) { if (res.body.blocks[i + 1] != null) { node.expect(res.body.blocks[i].height).to.be.below(res.body.blocks[i + 1].height); } } done(); }); });
it("should generate a valid number below exclusive maximum", () => { let max = MIN_SAFE_INTEGER + 10; let schema = new JsonSchema({ type: "integer", maximum: max, exclusiveMaximum: true }); for (let i = 0; i < iterations; i++) { expect(schema.sample()) .to.be.a("number") .and.satisfy(Number.isFinite) .and.satisfy(isWholeNumber) .and.at.least(MIN_SAFE_INTEGER) .and.below(max); } });
expect(() => { expect(1).to.not.be.below(null, "blah"); }).to.throw(AssertionError, "blah: the argument to below must be a number");
expect(() => { expect(1, "blah").to.be.below(null); }).to.throw(AssertionError, "blah: the argument to below must be a number");
expect(() => { expect(6).to.be.below(5, "blah"); }).to.throw(AssertionError, "blah: expected 6 to be below 5");
expect(() => { expect(1).to.be.below(null, "blah"); }).to.throw(AssertionError, "blah: the argument to below must be a number");
expect(() => { expect(6, "blah").to.be.below(5); }).to.throw(AssertionError, "blah: expected 6 to be below 5");