Closed begedin closed 7 years ago
Hey @begedin 👋
You're definitely right. Here is a quick twiddle demonstrating this in an acceptance test: https://ember-twiddle.com/367f2485e4d8e6ceaa31c0a9932eb2e3?openFiles=tests.acceptance.my-acceptance-test.js%2C
Would love a review if you think this works!
The twiddle works, but for the purpose of the documentation, I would go even more explicit and do something like
assert.ok(find('.alert.alert-info').length === 0)
or
assert.equal(find('.alert.alert-info').length, 0)
@begedin in that case, we would be asserting that the length is not 0. If it is 0, it will return falsy--all other values with be true. I kind of like that we are testing for its presence and not for a specific number.
Correct me if I'm wrong, but this seems to be the case on my environment:
The
assert.ok
helper uses!!result
to determine truthiness, so it will always pass in the example, since wind will either return an empty or a populated array.