How to use the expect.js function in expect

To help you get started, we’ve selected a few expect 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 serge10d1n / card-info / test / main.js View on Github external
it('should be an object', function () {
      expect(CardInfo._banks).to.be.an('object')
    })
github elastic / kibana / src / ui / public / agg_response / tabify / __tests__ / _table.js View on Github external
it('exposes rows array, but not the columns', function () {
    const table = new TabifyTable();
    expect(table.rows).to.be.an('array');
    expect(table.columns == null).to.be.ok();
  });
github elastic / kibana / src / server / index_patterns / service / lib / __tests__ / es_api.js View on Github external
it('handles errors with convertEsError()', async () => {
      const indices = [];
      const esError = new Error('esError');
      const convertedError = new Error('convertedError');

      sandbox.stub(convertEsErrorNS, 'convertEsError', () => { throw convertedError; });
      const callCluster = sinon.spy(async () => { throw esError; });
      try {
        await callFieldCapsApi(callCluster, indices);
        throw new Error('expected callFieldCapsApi() to throw');
      } catch (error) {
        expect(error).to.be(convertedError);
        sinon.assert.calledOnce(convertEsError);
        expect(convertEsError.args[0][0]).to.be(indices);
        expect(convertEsError.args[0][1]).to.be(esError);
      }
    });
  });
github Baggz / Amanda / tests / json / attributes / type / array.js View on Github external
test('should run 10 times', function() {
    expect(count).to.be.eql(10);
  });
github elastic / kibana / src / ui / public / agg_response / hierarchical / __tests__ / extract_buckets.js View on Github external
it('should normalize a bucket object into an array', function () {

      var bucket = {
        buckets: {
          foo: { doc_count: 1 },
          bar: { doc_count: 2 }
        }
      };

      var buckets = extractBuckets(bucket);
      expect(buckets).to.be.an(Array);
      expect(buckets).to.have.length(2);
      expect(buckets[0]).to.have.property('key', 'foo');
      expect(buckets[0]).to.have.property('doc_count', 1);
      expect(buckets[1]).to.have.property('key', 'bar');
      expect(buckets[1]).to.have.property('doc_count', 2);
    });
github elastic / kibana / src / cli / plugin / __tests__ / plugin_logger.js View on Github external
it('should log messages to the console and append not append a new line', function () {
          logger = pluginLogger({ silent: false, quiet: false });
          for (let i = 0; i < 10; i++) {
            logger.log('.', true);
          }
          logger.log('Done!');

          expect(process.stdout.write.callCount).to.be(13);
          expect(process.stdout.write.getCall(0).args[0]).to.be('.');
          expect(process.stdout.write.getCall(1).args[0]).to.be('.');
          expect(process.stdout.write.getCall(2).args[0]).to.be('.');
          expect(process.stdout.write.getCall(3).args[0]).to.be('.');
          expect(process.stdout.write.getCall(4).args[0]).to.be('.');
          expect(process.stdout.write.getCall(5).args[0]).to.be('.');
          expect(process.stdout.write.getCall(6).args[0]).to.be('.');
          expect(process.stdout.write.getCall(7).args[0]).to.be('.');
          expect(process.stdout.write.getCall(8).args[0]).to.be('.');
          expect(process.stdout.write.getCall(9).args[0]).to.be('.');
          expect(process.stdout.write.getCall(10).args[0]).to.be('\n');
          expect(process.stdout.write.getCall(11).args[0]).to.be('Done!');
          expect(process.stdout.write.getCall(12).args[0]).to.be('\n');
        });
github kissio / kiss.io / test / socket.io.js View on Github external
s.once('error', function(err){
            expect(err.message).to.match(/Illegal attachments/);
            done();
          });
          s.conn.on('upgrade', function(){
github jcreamer898 / fantasy-sports / test / fantasySports.spec.js View on Github external
.done(function(data) {  
                    expect(data.success).to.be.ok();
                });
github socketio / engine.io-client / test / connection.js View on Github external
function testBinary (data) {
        var byteArray = new Uint8Array(data);
        for (var i = 0; i < byteArray.byteLength; i++) {
          expect(byteArray[i]).to.be(i);
        }
      }
    });
github okv / east / test / 01-migrator / remove / withSuitableParams.js View on Github external
existResults.forEach((existResult) => {
					expect(existResult).equal(false);
				});
			});

expect

This package exports the `expect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect).

MIT
Latest version published 10 months ago

Package Health Score

91 / 100
Full package analysis