How to use the assert.strictEqual 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 googleanalytics / autotrack / test / media-query-tracker.js View on Github external
it('includes usage params with all hits', function() {
    browser.execute(ga.run, 'require', 'mediaQueryTracker');
    browser.execute(ga.run, 'send', 'pageview');
    browser.waitUntil(log.hitCountEquals(1));

    var hits = log.getHits();
    assert.strictEqual(hits[0].did, constants.DEV_ID);
    assert.strictEqual(hits[0][constants.VERSION_PARAM], pkg.version);

    // '8' = '0000001000' in hex
    assert.strictEqual(hits[0][constants.USAGE_PARAM], '8');
  });
github mediocre / petty-cache / test / index.js View on Github external
pettyCache.bulkGet(keys, function(err, data) {
                        assert.ifError(err);
                        assert.strictEqual(Object.keys(data).length, 7);
                        assert.strictEqual(data[key1], '');
                        assert.strictEqual(data[key2], 0);
                        assert.strictEqual(data[key3], false);
                        assert.strictEqual(typeof data[key4], 'number');
                        assert(isNaN(data[key4]));
                        assert.strictEqual(data[key5], null);
                        assert.strictEqual(data[key6], undefined);
                        assert.strictEqual(data[key7], null);

                        // Wait for Redis cache to expire
                        setTimeout(function() {
                            // Ensure keys are not in Redis
                            pettyCache.bulkGet(keys, function(err, data) {
                                assert.ifError(err);
                                assert.strictEqual(Object.keys(data).length, 7);
                                assert.strictEqual(data[key1], null);
github graalvm / graaljs / test / parallel / test-util-format.js View on Github external
assert.strictEqual(
  util.format('%d %d', 1180591620717411303424n, 12345678901234567890123n),
  '1180591620717411303424n 12345678901234567890123n'
);

// Integer format specifier
assert.strictEqual(util.format('%i'), '%i');
assert.strictEqual(util.format('%i', 42.0), '42');
assert.strictEqual(util.format('%i', 42), '42');
assert.strictEqual(util.format('%i', '42'), '42');
assert.strictEqual(util.format('%i', '42.0'), '42');
assert.strictEqual(util.format('%i', 1.5), '1');
assert.strictEqual(util.format('%i', -0.5), '0');
assert.strictEqual(util.format('%i', ''), 'NaN');
assert.strictEqual(util.format('%i %i', 42, 43), '42 43');
assert.strictEqual(util.format('%i %i', 42), '42 %i');
assert.strictEqual(
  util.format('%i', 1180591620717411303424),
  '1'
);
assert.strictEqual(
  util.format('%i', 1180591620717411303424n),
  '1180591620717411303424n'
);
assert.strictEqual(
  util.format('%i %i', 1180591620717411303424n, 12345678901234567890123n),
  '1180591620717411303424n 12345678901234567890123n'
);

assert.strictEqual(
  util.format('%d %i', 1180591620717411303424n, 12345678901234567890123n),
  '1180591620717411303424n 12345678901234567890123n'
github googleapis / nodejs-compute / test / autoscaler.js View on Github external
it('should localize the name', function() {
      assert.strictEqual(autoscaler.name, AUTOSCALER_NAME);
    });
github keymetrics / pm2-io-apm / src / census / plugins / __tests__ / http2.spec.ts View on Github external
function assertSpanAttributes (
    span: Span, httpStatusCode: number, httpMethod: string, hostName: string,
    path: string, userAgent?: string) {
  assert.strictEqual(
      span.status.code, Http2Plugin.convertTraceStatus(httpStatusCode))
  assert.strictEqual(
      span.attributes[Http2Plugin.ATTRIBUTE_HTTP_HOST], hostName)
  assert.strictEqual(
      span.attributes[Http2Plugin.ATTRIBUTE_HTTP_METHOD], httpMethod)
  assert.strictEqual(span.attributes[Http2Plugin.ATTRIBUTE_HTTP_PATH], path)
  assert.strictEqual(span.attributes[Http2Plugin.ATTRIBUTE_HTTP_ROUTE], path)
  assert.strictEqual(
      span.attributes[Http2Plugin.ATTRIBUTE_HTTP_USER_AGENT], userAgent)
  assert.strictEqual(
      span.attributes[Http2Plugin.ATTRIBUTE_HTTP_STATUS_CODE],
      `${httpStatusCode}`)
}
github Yomguithereal / mnemonist / test / multi-map.js View on Github external
assert.strictEqual(iterator.next().value, 'world');
    assert.strictEqual(iterator.next().value, 'hello');
    assert.strictEqual(iterator.next().done, true);

    assert.deepStrictEqual([...map.values()], ['hello', 'world', 'hello']);

    map = new MultiMap();

    map.set('one', 'hello');
    map.set('one', 'world');
    map.set('two', 'hello');

    iterator = map.values();

    assert.strictEqual(iterator.next().value, 'hello');
    assert.strictEqual(iterator.next().value, 'world');
    assert.strictEqual(iterator.next().value, 'hello');
    assert.strictEqual(iterator.next().done, true);

    assert.deepStrictEqual([...map.values()], ['hello', 'world', 'hello']);
  });
github stanford-oval / thingengine-core / test / functional / test_cloud_sync.js View on Github external
module.exports = async function testCloudSync(engine) {
    const platform = engine.platform;
    const prefs = platform.getSharedPreferences(platform);


    const tierManager = engine._tiers;

    assert.strictEqual(tierManager.ownTier, 'desktop');
    assert.strictEqual(tierManager.ownIdentity.length, 17);
    assert(tierManager.ownAddress.startsWith('desktop:'));

    const self = engine.devices.getDevice('thingengine-own-' + tierManager.ownAddress);
    assert(self);

    assert.strictEqual(self.tier, 'desktop');
    assert.strictEqual(self.identity, tierManager.ownIdentity);
    assert.strictEqual(self.address, tierManager.ownAddress);

    assert.strictEqual(prefs.get('cloud-id'), undefined);
    assert(!tierManager.isConnected('cloud'));

    engine.setCloudId(TEST_CLOUD_ID, TEST_AUTH_TOKEN);
    assert(tierManager.isConnected('cloud'));
github catberry / catberry / test / lib / streams / ResponseTransform.js View on Github external
.on('finish', function () {
					var response = renderingContext
						.routingContext.middleware.response;
					assert.strictEqual(renderingContext.isCanceled, false);
					assert.strictEqual(response.result, content);
					assert.strictEqual(response.status, 200);
					assert.strictEqual(
						Object.keys(response.setHeaders).length, 2
					);
					assert.strictEqual(
						typeof(response.setHeaders['Content-Type']), 'string'
					);
					assert.strictEqual(
						typeof(response.setHeaders['X-Powered-By']), 'string'
					);
					done();
				});
		});
github graalvm / graaljs / test / internet / test-dns.js View on Github external
result.forEach(function(ip) {
      if (isIPv4(ip.address))
        assert.strictEqual(ip.family, 4);
      else if (isIPv6(ip.address))
        assert.strictEqual(ip.family, 6);
      else
        assert.fail('unexpected IP address');
    });
  }
github ikr / money-math / spec / money.spec.js View on Github external
it("rounds 04 to 05", function () {
            assert.strictEqual(money.roundTo5Cents("2.04"), "2.05");
        });