Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@logicos/tinytest

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logicos/tinytest - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

demo.js

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
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc