0.0.12 • Published 8 years ago

fosho v0.0.12

Weekly downloads
33
License
-
Repository
github
Last release
8 years ago

💯 fosho

NPM version MIT License fliphub flipfam

don't just be sure, be fosho.

https://github.com/fliphub/fliphub

best of the best

extends

foshizzle

  • has fluent chaining
  • supports avajs assertion planning
  • has shortest assertions, and the longest .isStr() or .str()
  • it's not not... it aint: .aintReal()
  • uses power-assert

📦 usage

yarn add fosho
npm i fosho --save

📘 examples

example (avajs)

const test = require('ava')
const fosho = require('fosho')

class Workflow {}

test('fosho', (t) => {
  fosho('eh')
    .isReal()
    .isStr().str() // long or short hands
    .aintFunction()
  const fnb = () => {}
  function func() {}

  fosho(fnb)
    .fn()
    .aintBindable()
  fosho(func)
    .isFunction()
    .bindable()
    .all(['function', 'bindable'])

  fosho(fnb)
    .fn()
    .aintInstanceOf(Workflow)

  fosho('nice boulder')
    .str()
    .findString('nice')
    .findString('boulder')

  fosho(['one'])
    .lengthOf(1)
    .typeOf('array')

  fosho(1)
    .beAbove(0)
    .beBelow(2)
    .isAbove(0)
    .isBelow(2)
    .above(-1)
      .below(2)
})

test('fosho not a nice boulder...', (t) => {
  t.throws(() => {
    fosho({niceBoulder: true})
      .isReal()
      .isObj()
      .instanceOf(Workflow)
  })
})

// works with assertion planning
test('plan fosho', (t) => {
  t.plan(2)
  fosho({niceBoulder: true}, t)
    .isReal()
    .isObj()
})

exports

it also exports fliplog chai assert and chai should

const {fosho, log, should, assert} = require('chai')

resources