How to use the expect.js.fail 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 elastic / kibana / src / utils / streams / __tests__ / concat_stream.js View on Github external
it('fails when the value does not have a concat method', async () => {
      let promise;
      try {
        promise = createPromiseFromStreams([
          createListStream([1, '1']),
          createConcatStream()
        ]);
      } catch (err) {
        expect.fail('createPromiseFromStreams() should not fail synchronously');
      }

      try {
        await promise;
        expect.fail('Promise should have rejected');
      } catch (err) {
        expect(err).to.be.an(Error);
        expect(err.message).to.contain('concat');
      }
    });
  });
github elastic / kibana / src / utils / streams / __tests__ / concat_stream.js View on Github external
it('fails when the value does not have a concat method', async () => {
      let promise;
      try {
        promise = createPromiseFromStreams([
          createListStream([1, '1']),
          createConcatStream()
        ]);
      } catch (err) {
        expect.fail('createPromiseFromStreams() should not fail synchronously');
      }

      try {
        await promise;
        expect.fail('Promise should have rejected');
      } catch (err) {
        expect(err).to.be.an(Error);
        expect(err.message).to.contain('concat');
      }
    });
  });
github elastic / kibana / src / ui / directives / __tests__ / fixedScroll.js View on Github external
spy.thisValues.forEach(function ($this) {
          if ($this.is(els.$scroller) || $this.is(els.$container)) return;
          expect.fail('expected ' + name + ' to be called with $scroller or $container');
        });
      }

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 1 year ago

Package Health Score

88 / 100
Full package analysis