How to use the assert.ok function in assert

To help you get started, we’ve selected a few assert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ariatemplates / ariatemplates / test / node / gruntTasks.js View on Github external
testBuild(2, function () {

            // Retrieving this file without error implictly checks that the hash:false has been taken into account
            var packageContent = fs.readFileSync(testProjectPath + "target/two/plugins.js", 'utf8');
            assert.ok(!/require\(\\"ariatemplates\/Aria\\"\)/.test(packageContent), "Conversion to noderJS syntax has been done");
            assert.ok(/\{Template/.test(packageContent), "Template compilation has been done");
            assert.ok(!/Apache\sLicense/.test(packageContent), "stripBanner option didn't work");

            var flag;
            try {
                fs.readFileSync(testProjectPath + "target/two/atplugins/lightWidgets/DropDown.js", 'utf8');
                flag = false;
            } catch (ex) {
                flag = true;
            }
            assert.ok(flag, "Automatic dependency inclusion did not work");

            try {
                fs.readFileSync(testProjectPath + "target/two/app.js", 'utf8');
                flag = true;
            } catch (ex) {
github docusign / docusign-node-client / test / component tests / envelopes.js View on Github external
client.envelopes.getTemplateView(templateId, 'http://www.docusign.com/devcenter', function (error, response) {
        assert.ok(!error, 'Unexpected ' + error);
        var regex = new RegExp('https://demo.docusign.net/Member/StartInSession.aspx?');
        assert.ok(response.url);
        assert.strictEqual(true, regex.test(response.url));
        done();
      });
    });
github kekee000 / fonteditor-core / test / spec / main.spec.js View on Github external
it('entries', function () {
        assert.ok(fonteditor.Font, 'exports');
        assert.ok(fonteditor.TTF, 'exports');
        assert.ok(fonteditor.TTFReader, 'exports');
        assert.ok(fonteditor.TTFWriter, 'exports');
        assert.ok(fonteditor.ttf2eot, 'exports');
        assert.ok(fonteditor.eot2ttf, 'exports');
        assert.ok(fonteditor.ttf2woff, 'exports');
        assert.ok(fonteditor.woff2ttf, 'exports');
        assert.ok(fonteditor.ttf2svg, 'exports');
        assert.ok(fonteditor.svg2ttfobject, 'exports');
        assert.ok(fonteditor.Reader, 'exports');
        assert.ok(fonteditor.Writer, 'exports');
        assert.ok(fonteditor.OTFReader, 'exports');
        assert.ok(fonteditor.otf2ttfobject, 'exports');
        assert.ok(fonteditor.ttf2base64, 'exports');
        assert.ok(fonteditor.ttf2icon, 'exports');
        assert.ok(fonteditor.ttftowoff2, 'exports');
        assert.ok(fonteditor.woff2tottf, 'exports');
        assert.ok(fonteditor.woff2, 'exports');
        assert.ok(fonteditor.woff2.init, 'exports');
    });
});
github AlexeyKupershtokh / node-v8-clone / test / shared.js View on Github external
it('should clone inherited instances', function(){
      var clazz1 = function(c) { this.c = c };
      clazz1.prototype.e = 1;
      var clazz2 = function (c) { this.c = c };
      util.inherits(clazz2, clazz1);
      clazz2.prototype.d = 2;
      var a = new clazz2(3);
      var b = this.clone(a);
      assert.ok(a !== b);
      assert.ok(a.hasOwnProperty('c'));
      assert.ok(b.hasOwnProperty('c'));
      assert.ok(!a.hasOwnProperty('e'));
      assert.ok(!b.hasOwnProperty('e'));
      assert.ok(!a.hasOwnProperty('d'));
      assert.ok(!b.hasOwnProperty('d'));
      assert.equal(a.c, b.c);
      assert.equal(a.e, b.e);
      assert.equal(a.d, b.d);
    });
  });
github totaljs / framework / test / test-utils.js View on Github external
function prototypeNumber() {
	var format = '';
	assert.ok((10000).format(2) === '10 000.00', 'format number with decimal parameter');
	assert.ok((10000).format(3) === '10 000.000', 'format/decimal: A');
	assert.ok((10000).format(3, ',', '.') === '10,000.000', 'format/decimal: B');
	assert.ok((10000).format() === '10 000', 'format/decimal: C');
	var number = 10.103435;
	assert.ok(number.floor(2) === 10.10, 'floor number: 2 decimals');
	assert.ok(number.floor(4) === 10.1034, 'floor number: 4 decimals');
	assert.ok(number.floor(0) === 10, 'floor number: 0 decimals');
	assert.ok(number.hex() === 'A.1A7AB75643028', 'number to hex');
	assert.ok(number.add('10%', 0) === 1, 'add number: 1');
	assert.ok(number.add('+10%', 0) === 11, 'add number: 2');
	assert.ok(number.add('-10%', 0) === 9, 'add number: 3');
	assert.ok(number.add('*2', 0) === 20, 'add number: 4');
	assert.ok(number.add('*10%', 0) === 112, 'add number: 5');
}
github jxcore / jxcore / test / simple / test-fs-read-stream.js View on Github external
file.on('data', function(data) {
  assert.ok(data instanceof Buffer);
  assert.ok(!paused);
  file.length += data.length;

  paused = true;
  file.pause();

  setTimeout(function() {
    paused = false;
    file.resume();
  }, 10);
});
github hpcloud / swift-webdav / test / test-ifrules.js View on Github external
new IfRules(' (["abc"])').evaluate(mockres, function (e, token) {
  if (e) {
    throw e;
  }
  //assert.equal(token, 'locktoken');
  assert.ok(!token);
});
github zendesk / ipcluster / lib / iptables.js View on Github external
function run_iptables_command(command, ip, slot, mask, from, to, cb) {
	switch (command) {
		case 'I':
		case 'D':
			assert.ok(net.isIPv4(ip));
			assert.equal(typeof slot, 'number');
			assert.equal(typeof mask, 'number');
			from = parseInt(from, 10);
			to   = parseInt(to  , 10);
			assert.ok( from > 0 && from < 65536 );
			assert.ok( to   > 0 && to   < 65536 );
			break;

		case 'L':
			cb = ip;
			break;

		default: throw 'Bad iptables command'
	}

	var cmd = replace(CMD_IPT_CMD[command], {
github oortcloud / meteorite / spec / acceptance / helpers.js View on Github external
killProcessFamily(mrt.pid, function() {
        assert.ok(false, 'Output incorrectly matched' + failStrings.join(','));
      });
    }