Fix assertion descriptions (#2405)
* Fix assertion descriptions Move return statement to the end of define() * ospec: Fix assertion definitions * Fix typo in assertion * Add test for descriptions being returned on fail * Reference result instead of self in returned description method * Fix style errors
This commit is contained in:
parent
ddb3d4ab07
commit
0ea6a190b6
3 changed files with 24 additions and 2 deletions
|
|
@ -299,7 +299,7 @@ o.spec("ospec", function() {
|
|||
})
|
||||
})
|
||||
|
||||
o.spec("throwing in test context is recoreded as a failure", function() {
|
||||
o.spec("throwing in test context is recorded as a failure", function() {
|
||||
var oo
|
||||
o.beforeEach(function(){oo = o.new()})
|
||||
o.afterEach(function() {
|
||||
|
|
@ -659,6 +659,24 @@ o.spec("ospec", function() {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
o.spec("descriptions", function() {
|
||||
o("description returned on failure", function(done) {
|
||||
var oo = o.new()
|
||||
oo("no description", function() {
|
||||
oo(1).equals(2)
|
||||
})
|
||||
oo("description", function() {
|
||||
oo(1).equals(2)("howdy")
|
||||
})
|
||||
oo.run(function(results) {
|
||||
o(results.length).equals(2)
|
||||
o(results[1].message).equals(`howdy\n\n${results[0].message}`)
|
||||
o(results[1].pass).equals(false)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
o.spec("the done parser", function() {
|
||||
o("accepts non-English names", function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue