expecto-patronum

0.0.1 • Public • Published

expecto('cast', patronum => {...})

Function with predicates

Not supposed to have a lot of usage, it's made just for fun.

npm i expecto-patronum
import { expecto } from 'expecto-patronum'
 
/**
 * For now works with sync stuff only
 */
expecto(
  'All tests should PASS',
  patronum => {
    /**
     * For now that's all predicates here listed, lol
     */
    patronum(0).beFalsy()
    patronum(1).beEqual(1)
    patronum(2).beSame(2)
    patronum(3).beTruthy()
    patronum({ a: 'a', b: 'b' }).beEquallyStringified({ a: 'a', b: 'b' })
  },
  /**
   * Callback gets { fail: number; success: number; }
   * So it could be just console.log as a callback
   */
  tests => console.log(tests)
)
 
expecto(
  'All tests should FAIL',
  patronum => {
    patronum(1).beFalsy()
    patronum(2).beEqual(3)
    patronum([]).beSame([])
    patronum(0).beTruthy()
    patronum({ a: 'a', b: 'b' }).beEquallyStringified({ b: 'b', a: 'a' })
  },
  console.log
)
 

Readme

Keywords

Package Sidebar

Install

npm i expecto-patronum

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

13.8 kB

Total Files

14

Last publish

Collaborators

  • theaklair