0.1.1 • Published 6 years ago

coinobi v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Coinobi

Deterministic and non-deterministic boolean testing utilities

No such thing as luck

"In my experience, there's no such thing as luck"

The Problem

When testing, you sometimes want some random values to avoid using the same static data in each test and avoid missing edge cases.

However, this comes with a couple of problems:

  • For testing purposes you want your data to be predictable
  • Sometimes randomness isn't diverse. For example, it's possible that 5 coin flips in a row all turn up heads. This is a problem if your tests rely upon at least one value being true/false.

Coinobi gives you deterministic luck by allowing you to specify patterns of returned results.

Of course, you are welcome to use this packages for non-testing scenarios

Examples

CreateCoin

createCoin - create a coin that has flips which alternate between true and false

import { createCoin } from 'coinobi'

const coin = createCoin()

coin.flip() // true
coin.flip() // false
coin.flip() // true
coin.flip() // false
coin.flip() // true
// ...
0.1.1

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago