test(function (t) { t.ok(false) t.notOk(true) t.equal('foo', 'bar') t.deepEqual({ foo: 1 }, { bar: 1 }) t.end() })
test('timeout', function (t) { t.plan(5) t.notOk(timeout.optional(function () { t.fail('should not be called') }, 0)) t.notOk(timeout.optional(function () { t.fail('should not be called') }, -1)) t.notOk(timeout.optional(function () { t.fail('should not be called') }, Infinity)) t.ok(timeout.optional(function () { t.pass() }, 1)) })
test('proxies approximateSize() if it exists', function (t) { t.is(typeof encdown({ approximateSize: noop }).approximateSize, 'function') t.ok(encdown({ approximateSize: noop }).supports.additionalMethods.approximateSize) t.is(encdown({}).approximateSize, undefined) t.notOk(encdown({}).supports.additionalMethods.approximateSize) t.end() })
test('valid predicate and sync statement', function(t) { async.waterfall([ async.constant({name: 'thiago'}), async.if(containsNameSync, createAccount), ], verify); function verify(err, result) { t.notOk(err, 'there is no error'); t.equal(result.name, 'thiago', 'payload name is the same as initial'); t.ok(result.id, 'create account modified the payload'); t.end(); } });
test('codec, new not needed', function (t) { var codec = Codec({ keyEncoding: 'hex' }) t.ok(codec.keyAsBuffer()) codec = Codec() t.notOk(codec.keyAsBuffer()) t.end() })
test('iterator does not add nullish range options', function (t) { t.plan(4) encdown({ iterator: function (options) { t.notOk(hasOwnProperty.call(options, 'gt')) t.notOk(hasOwnProperty.call(options, 'gte')) t.notOk(hasOwnProperty.call(options, 'lt')) t.notOk(hasOwnProperty.call(options, 'lte')) } }).iterator({}) })
test('.enqueue() without arguments queues undefined', t => { let q = new Queue(); q.enqueue(); t.notOk(q.isEmpty, 'queue not empty'); t.equal(q.length, 1, 'queue length of 1 (one)'); t.equal(q.peek(), undefined, 'queued item is undefined (when peeked)'); t.end(); });
test('value as buffer', function (t) { var codec = new Codec({ valueEncoding: 'hex' }) t.ok(codec.valueAsBuffer({})) t.ok(codec.valueAsBuffer()) t.notOk(codec.valueAsBuffer({ valueEncoding: 'utf8' })) t.end() })
test('request /loq/ping', function (t) { Request.post(constants.endpoints.misc.ping, function (err, result) { t.notOk(err) t.ok(result) t.ok(result.timestamp) t.end() }) })
test('bulkDetails', function (t) { var details = exec('./bin/bulk-details com.viber.voip air.WatchESPN', function (error, stdout, stderr) { t.notOk(error, 'should exit cleanly'); t.ok(stdout.length > 0, 'should produce some output'); t.doesNotThrow(JSON.parse.bind(null, stdout), 'parses json'); t.end(); }); });
test('key as buffer', function (t) { var codec = new Codec({ keyEncoding: 'hex' }) t.ok(codec.keyAsBuffer({})) t.ok(codec.keyAsBuffer()) t.notOk(codec.keyAsBuffer({ keyEncoding: 'utf8' })) t.end() })
test('invalid predicate and sync statement', function(t) { async.waterfall([ async.constant({name: 'thiago'}), async.if(falsyValidation, createAccount), ], verify); function verify(err, result) { t.notOk(err, 'there is no error'); t.equal(result.name, 'thiago', 'payload name is the same as initial'); t.notOk(result.id); t.end(); } });
test(function (t) { t.ok(true) t.notOk(false) t.equal('foo', 'foo') t.deepEqual({ foo: 1 }, { foo: 1 }) t.end() })
test('codec', function (t) { var codec = new Codec({ keyEncoding: 'hex' }) t.ok(codec.keyAsBuffer()) codec = new Codec() t.notOk(codec.keyAsBuffer()) t.end() })