How to use the chai.assert.ok function in chai

To help you get started, we’ve selected a few chai 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 azuqua / notp / test / unit / table.js View on Github external
it("Should return if table is idle or not", function () {
        assert.ok(table.idle());

        var streams = new Map([["key", "value"]]);
        table.streams(streams);
        assert.notOk(table.idle());
        table.streams(new Map());

        table._pollCursor = 1;
        assert.notOk(table.idle());
        table._pollCursor = null;

        table._migrateCursor = 1;
        assert.notOk(table.idle());
        table._migrateCursor = null;
      });
github datastax / nodejs-driver / test / unit / basic-tests.js View on Github external
it('should get the value by column name or index', function () {
      const columns = [{name: 'first', type: { code: dataTypes.varchar}}, {name: 'second', type: { code: dataTypes.varchar}}];
      const row = new types.Row(columns);
      row['first'] = 'hello';
      row['second'] = 'world';
      assert.ok(row.get, 'It should contain a get method');
      assert.strictEqual(row['first'], 'hello');
      assert.strictEqual(row.get('first'), row['first']);
      assert.strictEqual(row.get(0), row['first']);
      assert.strictEqual(row.get('second'), row['second']);
      assert.strictEqual(row.get(1), row['second']);
    });
    it('should enumerate only columns defined', function () {
github hung-phan / koa-react-isomorphic / app / share / components / routing / __tests__ / logicBundle.js View on Github external
it("should be a function", () => {
    assert.ok(reducer);
    assert.isFunction(reducer);
  });
github zabute / formsy-semantic-ui-react / test / FormsyCheckbox.spec.js View on Github external
it('Doesn\'t show any errors initially', () => {
      assert.ok(checkbox.props().isValid());
      assert.equal(wrapper.find('.error-label').length, 0);
    });
github auth0 / node-baas / test / server.tests.js View on Github external
client.compare(password, hash, function (err, success) {
      if (err) return done(err);
      assert.ok(success);
      done();
    });
  });
github mozilla / fxa-auth-server / test / local / metrics / context.js View on Github external
}, {}).then(function (result) {
        assert.equal(typeof result, 'object', 'result is object')
        assert.notEqual(result, null, 'result is not null')
        assert.equal(Object.keys(result).length, 13, 'result has 13 properties')
        assert.ok(result.time > time, 'result.time seems correct')
        assert.equal(result.device_id, 'mock device id', 'result.device_id is correct')
        assert.equal(result.flow_id, 'mock flow id', 'result.flow_id is correct')
        assert.ok(result.flow_time > 0, 'result.flow_time is greater than zero')
        assert.ok(result.flow_time < time, 'result.flow_time is less than the current time')
        assert.equal(result.flowBeginTime, time, 'result.flowBeginTime is correct')
        assert.equal(result.flowCompleteSignal, 'mock flow complete signal', 'result.flowCompleteSignal is correct')
        assert.equal(result.flowType, 'mock flow type', 'result.flowType is correct')
        assert.equal(result.service, 'mock service', 'result.service is correct')
        assert.equal(result.utm_campaign, 'mock utm_campaign', 'result.utm_campaign is correct')
        assert.equal(result.utm_content, 'mock utm_content', 'result.utm_content is correct')
        assert.equal(result.utm_medium, 'mock utm_medium', 'result.utm_medium is correct')
        assert.equal(result.utm_source, 'mock utm_source', 'result.utm_source is correct')
        assert.equal(result.utm_term, 'mock utm_term', 'result.utm_term is correct')

        assert.equal(cache.get.callCount, 0, 'cache.get was not called')
        assert.equal(log.error.callCount, 0, 'log.error was not called')
      })
    }
github ethereum-alarm-clock / cli / test / drainWallet.js View on Github external
const gasLimit = '21000'
                const gasCost = new BigNumber(gasLimit).times(EXAMPLE_GAS_PRICE)

                assert.equal(options.to, EXAMPLE_TARGET_ADDRESS)
                assert.equal(options.value, balanceAsBigNumber.minus(gasCost))
                assert.equal(options.gas, gasLimit)
                assert.equal(options.gasPrice, EXAMPLE_GAS_PRICE)
                assert.equal(options.data, '')

                return Promise.resolve(EXAMPLE_TX_HASH)
            }
        };

        await drainWallet({}, EXAMPLE_GAS_PRICE, EXAMPLE_TARGET_ADDRESS, wallet, util)

        assert.ok(getBalanceCalled, 'util.getBalance() has to be called')
        assert.ok(sendFromIndexCalled, 'wallet.sendFromIndex() has to be called')
        assert.ok(waitForTransactionToBeMinedCalled, 'util.waitForTransactionToBeMined() has to be called')
    })
})
github jovotech / jovo-framework / test / tests.js View on Github external
app.on('respond', function(jovo) {
                let response = jovo.getPlatform().getResponse();
                assert.ok(response.isEmptyResponse());
                done();
            });
github mui-org / material-ui / src / Stepper / StepContent.spec.js View on Github external
it('renders a div', () => {
    const wrapper = shallowWithContext(
      
    );
    assert.ok(wrapper.is('div'));
  });
github gridgain / gridgain / modules / web-console / frontend / app-angular / components / form-field / formField.component.spec.ts View on Github external
test('Validation styles', () => {
        fixture.componentInstance.form.get('two').markAsTouched();
        fixture.componentInstance.form.get('three').markAsTouched();
        fixture.detectChanges();
        assert.ok(
            fixture.nativeElement.querySelector('form-field:nth-of-type(2)>form-field-errors'),
            'Displays errors inline when "inline" errorStyle is used.'
        );
        assert.ok(
            fixture.nativeElement.querySelector('form-field:nth-of-type(3) .input-overlay form-field-errors'),
            'Displays errors in overlay when "icon" errorStyle is used.'
        );
    });
    test('Validation message display conditions', () => {