easily-expect
Advanced tools
Comparing version
@@ -83,4 +83,5 @@ 'use strict' | ||
exports.checkNotEmpty = require('./checkNotEmpty') | ||
exports.checkBelow = require('./checkBelow') | ||
exports.init = data => { | ||
cacheData = data | ||
} |
{ | ||
"name": "easily-expect", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "You can easily use expect", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
[](https://travis-ci.org/KSH-code/easily-expect) | ||
 | ||
# HOW TO USE ? | ||
# Usage | ||
``` | ||
npm install --save easily-expect | ||
``` | ||
``` | ||
const { checkType, checkMatch, checkEqual, checkObject, init, checkValue } = require('easily-expect') | ||
describe (...) | ||
init({ | ||
test1: { | ||
test2: /^\d*$/ | ||
}, | ||
test3: /^[a-z]{1,10}$/, | ||
test4: [/^[a-z]{1,10}$/, /^\d*$/, { | ||
test5: /^\d*$/ | ||
}] | ||
}) | ||
it (...) | ||
checkType('string', '123', '0') | ||
it (...) | ||
checkMatch(/\d/, '1', '123', '1234') | ||
it (...) | ||
checkEqual('abc', 'abc', 'aaa') // aaa is false | ||
it (...) | ||
checkObject({ test1: { test2: '123123123' } }) | ||
it(...) | ||
checkObject({ test4: ['aaa', '123', { test5: '123' }, 'aaa', '123', { test5: '123' }] }) | ||
it(...) | ||
checkArray([/^\d*$/, /[a-z]{1,10}/, { test1: /^\d*$/ }], ['123', 'a', { test1: '123' }, '123','a', { test1: '123' }], ['123', 'a', { test1: '123' }]) | ||
it('Test Object type', () => { | ||
checkValue({ a: 1 }, { b: true }, {}) | ||
}) | ||
it('Check Strings in Array', () => { | ||
checkArray([/^\d*$/, /[a-z]{1,10}/], ['123', 'a', '123', 'a'], ['123', 'a', '123', 'a']) | ||
}) | ||
it('1. simple test', () => { | ||
checkAbove(2, 3, 4, 'abc'.length, 'abcd'.length) | ||
}) | ||
``` | ||
## Example | ||
@@ -52,3 +16,4 @@ * [checkType](https://github.com/KSH-code/easily-expect/blob/master/test/checkType.test.js) | ||
* [checkAbove](https://github.com/KSH-code/easily-expect/blob/master/test/checkAbove.test.js) | ||
* [checkBelow](https://github.com/KSH-code/easily-expect/blob/master/test/checkBelow.test.js) | ||
* [checkEmpty](https://github.com/KSH-code/easily-expect/blob/master/test/checkEmpty.test.js) | ||
* [checkNotEmpty](https://github.com/KSH-code/easily-expect/blob/master/test/checkNotEmpty.test.js) |
20
11.11%283
8.02%12323
-4.52%19
-64.81%