mercredi 7 septembre 2016

Jasmine toThrow does not work even though an error is thrown

This code fails even though an error is thrown.

it('should throw error when foo config value is falsey', (done) => {
  const config = { foo: null, bar: 'some-name' };
  expect(quux.withConfig(config).load('*', (err, inst) => { done(); })).toThrow();
});

I've also tried this

it('should throw error when foo config value is falsey', (done) => {
  const config = { foo: null, bar: 'some-name' };
  expect(SelfServiceCompletedJobStore.withConfig(config).load('*', (err, inst) => { })).toThrow();
  done();
});

Error Message:

should throw error when foo config value is falsey
  - Error: Requires a non-empty foo:String

Aucun commentaire:

Enregistrer un commentaire