jasmine-jquery icon indicating copy to clipboard operation
jasmine-jquery copied to clipboard

toBeEmpty() matcher inconsistent behavior

Open aletheia opened this issue 8 years ago • 0 comments

toBeEmpty fails when checked object is not defined, but matcher when used in with .not does not fail if checked node is undefined.

  describe("toBeEmpty() bug with undefined", function() {
    it("works correctly when requiring being empty", function() {
    expect(undefined).toBeEmpty() // this fails with message "undefined is not empty"
  })

  it("behaves unexpectedly when using .not", function() {
    expect(undefined).not.toBeEmpty() // this does not fail
  })
})

aletheia avatar Sep 16 '16 16:09 aletheia