0.0.1 • Published 5 years ago

expecto-patronum v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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
)
0.0.1

5 years ago