Skip to content

Files

Latest commit

 

History

History
75 lines (32 loc) · 957 Bytes

nimble_operator.md

File metadata and controls

75 lines (32 loc) · 957 Bytes

Pattern: Missing use of Nimble operator

Issue: -

Description

Prefer Nimble operator overloads over free matcher functions.

Examples of correct code:

expect(seagull.squawk) != "Hi!"


expect("Hi!") == "Hi!"


expect(10) > 2


expect(10) >= 10


expect(10) < 11


expect(10) <= 10


expect(x) === x


expect(10) == 10


expect(object.asyncFunction()).toEventually(equal(1))


expect(actual).to(haveCount(expected))

Examples of incorrect code:

expect(seagull.squawk).toNot(equal("Hi"))


expect(12).toNot(equal(10))


expect(10).to(equal(10))


expect(10).to(beGreaterThan(8))


expect(10).to(beGreaterThanOrEqualTo(10))


expect(10).to(beLessThan(11))


expect(10).to(beLessThanOrEqualTo(10))


expect(x).to(beIdenticalTo(x))


expect(10) > 2
 expect(10).to(beGreaterThan(2))

Further Reading