@Garrick wrote:
Version: ember@~3.1.0, ember-cli@~3.1.4
My component has a computed property that throws an error when the component is used without passing an attribute to replace the computed property.
How do I catch the error in my rendering test? Both
assert.throws
andassert.rejects
do not catch the error.My computed property looks like:
someProperty: computed(function() { throw new Error('some error'); })
My test looks like:
module('my-component test', function(hooks) { setupRenderingTest(hooks); test('throws', function(assert) { // Doesn't work, because render returns a promise. assert.throws(() => { render(hbs`{{my-component}}`); }); // Doesn't work... assert.rejects(render(hbs`{{my-component}}`)); ;}) });
Posts: 3
Participants: 2