|
|
@ -204,8 +204,33 @@ test('handle throws with resolved promise', function (t) { |
|
|
|
var promise = Promise.resolve(); |
|
|
|
a.throws(promise); |
|
|
|
}).run().catch(function (err) { |
|
|
|
t.true(err); |
|
|
|
t.is(err.name, 'AssertionError'); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
test('handle throws with regex', function (t) { |
|
|
|
ava(function (a) { |
|
|
|
a.plan(1); |
|
|
|
|
|
|
|
var promise = Promise.reject(new Error('abc')); |
|
|
|
a.throws(promise, /abc/); |
|
|
|
}).run().then(function (a) { |
|
|
|
t.false(a.assertionError); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
test('handle throws with false-positive promise', function (t) { |
|
|
|
ava(function (a) { |
|
|
|
a.plan(1); |
|
|
|
|
|
|
|
var promise = Promise.resolve(new Error()); |
|
|
|
a.throws(promise); |
|
|
|
}).run().catch(function (err) { |
|
|
|
t.true(err); |
|
|
|
t.is(err.name, 'AssertionError'); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -218,8 +243,8 @@ test('handle doesNotThrow with error', function (t) { |
|
|
|
|
|
|
|
a.end(); |
|
|
|
}).run().catch(function (err) { |
|
|
|
t.is(err.name, 'AssertionError'); |
|
|
|
t.true(err); |
|
|
|
t.is(err.name, 'AssertionError'); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -257,6 +282,7 @@ test('handle doesNotThrow with rejected promise', function (t) { |
|
|
|
a.doesNotThrow(promise); |
|
|
|
}).run().catch(function (err) { |
|
|
|
t.true(err); |
|
|
|
t.is(err.name, 'AssertionError'); |
|
|
|
t.end(); |
|
|
|
}); |
|
|
|
}); |
|
|
|