@logicos/tinytest
Advanced tools
Comparing version 0.2.0 to 0.3.0
11
index.js
@@ -25,7 +25,6 @@ const btest = (result = false, expectation = true) => result === expectation; | ||
module.exports = { | ||
btest, | ||
runSpec, | ||
runspec: runSpec, | ||
test, | ||
} | ||
exports.btest = btest; | ||
exports.runSpec = runSpec; | ||
exports.runspec = runSpec; | ||
exports.test = test; | ||
{ | ||
"name": "@logicos/tinytest", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "author": "Brilliance Labs <tech@bl.io>", |
# @logicos/tinytest | ||
## Install | ||
## Install - v0.3.0 | ||
@@ -19,21 +19,29 @@ ```bash | ||
## How to use (test) | ||
This package exposes testing tools for quick logic expectations to the more formal runSpec which allows for testing of sync and async functions simply. | ||
@NOTE: **truthy** not required, just used as an example :) | ||
## How to use \{ test \} | ||
```js | ||
const test = require('@logicos/tinytest'); | ||
test(something(), somethingElse(), 'Something and Something else check'); | ||
const { test } = require('@logicos/tinytest'); | ||
``` | ||
```blank | ||
Something and Something else check has passed!! | ||
```js | ||
test(something(), somethingElse()); | ||
// --> Test has passed! | ||
// or | ||
// --> Test has failed! | ||
``` | ||
or | ||
```js | ||
test(something(), somethingElse(), 'Something check'); | ||
```blank | ||
Something and Something else check has failed!! | ||
// --> Something check has passed! | ||
// or | ||
// --> Something check has failed! | ||
``` | ||
## How to use (runSpec) | ||
## How to use \{ runSpec \} | ||
@@ -44,6 +52,52 @@ ```js | ||
runSpec({ | ||
name: 'Simple -> false', | ||
name: 'Example of a pass', | ||
test: truthy.validate('foo', 'isFoo'), | ||
expect: true, | ||
}); | ||
``` | ||
```bash | ||
Example of a pass ✅ | ||
``` | ||
```js | ||
runSpec({ | ||
name: 'Example of a fail', | ||
test: truthy.validate('foo', 'isBar'), | ||
expect: false, | ||
expect: true, | ||
}); | ||
``` | ||
```bash | ||
Example of a fail ❌ | ||
``` | ||
### RunSpec also works with Async | ||
```js | ||
runSpec({ | ||
name: 'Function that returns "foo" after some time', | ||
test: truthy.validate(eventuallyFoo(), 'isFoo'), | ||
expect: true, | ||
}); | ||
``` | ||
```bash | ||
Function that returns "foo" after some time ✅ | ||
``` | ||
### How to use \{ btest \} | ||
btest only returns a boolean result of your test, no special messages. | ||
```js | ||
btest(truthy.validate(2, 'isEven'), true); | ||
btest(truthy.validate(2, 'isOdd'), true); | ||
btest(truthy.validate(2, 'isOdd'), false); | ||
``` | ||
```bash | ||
true | ||
false | ||
true | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3143
4
45
102