How to use the equal function from assert-plus

Find comprehensive JavaScript assert-plus.equal code examples handpicked from public code repositorys.

36
37
38
39
40
41
42
43
44
45
  _set(libToEntryMap, key, e);
} else if (e.enclosedBy) {
  assert.notEqual(e.type, 'library');
  key = e.enclosedByQualifiedName;
} else {
  assert.equal(e.type, 'library');
  // Add library "index" page to the library's entries in the general container map,
  // but not the lib map which is used to create the main API page index.
  key = e.libName;
  _set(containerToEntryMap, key, e);
fork icon80
star icon90
watch icon0

613
614
615
616
617
618
619
620
621
622
623
    assert.ok(_pg.client.connection, 'pg connection');
    assert.ok(_pg.client.connection.stream, 'pg stream');
    assert.ok(_pg.client.connection.stream.readable, 'pg readable');
    assert.ok(!_pg.client.connection.stream.destroyed, 'pg not destroyed');
    assert.ok(_pg.client.connection.stream.writable, 'pg writable');
    assert.equal(false, _pg._moray_txn, 'finished transaction');


    return (_pg._moray_had_err === null);
}

fork icon21
star icon60
watch icon0

1404
1405
1406
1407
1408
1409
1410
1411
1412
var l = 0;
var spl;

assert.string(ip, 'ip');
spl = ip.split('.');
assert.equal(spl.length, 4, 'ip octet length');

spl.forEach(function processIpOctet(octet) {
    octet = parseInt(octet, 10);
fork icon38
star icon55
watch icon41

2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
    break;
case alarms.AmonMaintWindow.WIN_SCOPE_PROBES:
    fprintf(stream, 'specific probes: ');
    break;
default:
    assertplus.equal(
        maintwin.win_scope,
        alarms.AmonMaintWindow.WIN_SCOPE_PROBEGROUPS
    );
    fprintf(stream, 'specific probe groups: ');
fork icon13
star icon7
watch icon42

879
880
881
882
883
884
885
886
887
888
for (i = 0; i < lines.length; i++) {
    var line = lines[i].trim();
    if (line.length === 0)
        continue;
    var parts = line.split('\t');
    assert.equal(parts.length, 4);
    name = parts[0];
    var origin = parts[1];
    var mountpoint = parts[2];
    var ignore = parts[3];
fork icon248
star icon0
watch icon0

+ 3 other calls in file

888
889
890
891
892
893
894
895
896
897
        return next();
    }
}
ping(opts, function (err, _, res, req) {
    if (!err) {
        assert.equal(res.statusCode, 200,
            'ping success without 200');
        // No authorization is necessary.
        authInfo = {};
        next(true);  // early pipeline abort
fork icon35
star icon59
watch icon0

523
524
525
526
527
528
529
530
531
532
533
        // we expect, though we don't parse so we don't warn about those and
        // just do nothing.
        /* END JSSTYLED */
        /* eslint-enable */
    } else {
        mod_assert.equal(line, '', 'unexpected output line from ntpq');
    }
}


NtpGetter.prototype.get = function get(callback) {
fork icon8
star icon3
watch icon0

+ 3 other calls in file

148
149
150
151
152
153
154
155
156
157
 * valid. For instance, that their DATA_VERSION numbers are a proper
 * sequence starting at 1, and that they export a function named
 * "migrateRecord".
 */
for (idx = 0; idx < migrationsForBucket.length; ++idx) {
    assert.equal(migrationsForBucket[idx].DATA_VERSION,
        expectedDataVersion, 'Data version of migration ' + (idx + 1) +
            ' should be ' + expectedDataVersion);
    assert.func(migrationsForBucket[idx].migrateRecord,
            'migrationsForBucket[' + idx + '].migrateRecord');
fork icon20
star icon11
watch icon0

614
615
616
617
618
619
620
621
622
623
    'initialDelay': 1000,
    'maxDelay': 300000
});

this.initBackoff.on('backoff', function (which, delay, error) {
    assert.equal(which + 1, self.initAttempts);
    self.log.warn({
        'nfailures': which + 1,
        'willRetryAfterMilliseconds': delay,
        'error': error
fork icon6
star icon2
watch icon0

91
92
93
94
95
96
97
98
99
100
var self = this;

assert.object(spanCtx, 'spanCtx');
assert.uuid(spanCtx._spanId, 'spanCtx._spanId');
assert.uuid(spanCtx._traceId, 'spanCtx._traceId');
assert.equal(format, opentracing.FORMAT_TEXT_MAP, 'Unsupported format');
assert.object(carrier, 'carrier');

// We only support "TextMap" format which we assume for now is a restify
// opts.headers object.
fork icon4
star icon0
watch icon0

+ 3 other calls in file

104
105
106
107
108
109
110
111
112
113

if (config.port) {
    assert.string(config.address, 'config.address');
    assert.number(config.port, 'config.port');
} else {
    assert.equal(undefined, config.address, 'config.address');
    assert.string(config.path, 'config.path');
}

var collector = artedi.createCollector({labels: config.staticLabels});
fork icon3
star icon0
watch icon0

544
545
546
547
548
549
550
551
552
553
554
555
556
function processSpanLog(stor, obj) {


    if (!obj.hasOwnProperty(MAGIC_KEY)) {
        return;
    }
    assert.equal(obj[MAGIC_KEY], MAGIC_VAL, 'bad magic');


    var zipobj = objHandler(obj);


    if (!stor.queue) {
fork icon2
star icon1
watch icon0

73
74
75
76
77
78
79
80
81
82
Chain.prototype.add = function add(handler) {
    assert.func(handler);
    var handlerId = handler._identifier || handler._name || handler.name;
    if (handler.length <= 2) {
        // arity <= 2, must be AsyncFunction
        assert.equal(
            handler.constructor.name,
            'AsyncFunction',
            `Handler [${handlerId}] is missing a third argument (the ` +
                '"next" callback) but is not an async function. Middleware ' +
fork icon0
star icon2
watch icon0