1.2.0 • Published 3 years ago

assert-op v1.2.0

Weekly downloads
36
License
MIT
Repository
github
Last release
3 years ago

assert-op

assertions with javascript comparison operators

WhyExampleFeaturesLicense

Why

This originated as an attempt to have assertions that are less verbose because assert.notDeepStrictEqual and the likes are ugly.

Example

import t from 'assert-op'

t('mytest', a => {
  a('==', 2, 2)
  a`==`(2, 2, 'this alternate form is also possible')
  a`!==`(3, 4, 'should be unequal')
  a`<`(1, 2)
  a`!`(null, 'should be falsy')
  a`!{===}`([], 'str', 'should be notDeepStrictEqual')
  a('{==}', [2], 2, 'should be deepEqual')
  a('!==', 3, 4)
  a('{===}', new Set([1,2]), new Set([1,2]))
  a('{===}', new Map([[1,2]]), new Map([[1,2]]))
})

Features

  • Javascript Comparison Operators (==, !==, ===, !===, <, <=, >, >=)
  • Negation (!, !!)
  • Other symbols for nested object
    • {==}: deepEqual
    • !{==}: notDeepEqual
    • {===}: strictDeepEqual
    • !{===}: notStrictDeepEqual
  • throws and !throws for assert.throws
  • Support ES2015 Set and Map

License

MIT © Hugo Villeneuve

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

4 years ago

0.5.1

4 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

7 years ago

0.0.1

7 years ago