From 50ad7e9e7ff6e8d565297a172c8736faf39a1e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alvaro=20Cabrera=20Dur=C3=A1n?= <pateketrueke@gmail.com> Date: Mon, 1 Oct 2018 12:57:39 -0500 Subject: [PATCH] Update TESTING info --- docs/TESTING.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/TESTING.md b/docs/TESTING.md index 1bb24ce3..1ab36f05 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -1,12 +1,15 @@ + ## Testing -**JSON-Schema-Faker** has performs two types of testing: unit and schema. +**JSON-Schema-Faker** performs two types of testing: unit and schema. ### Unit tests - They just validate the building blocks from the entire library - We're using `mocha` and `chai` so the worflow would be very familiar +> Much stuff from the internals are not covered by unit-tests yet, PRs for increasing that are very welcome! + ---- ### Schema tests @@ -49,15 +52,16 @@ The properties below are used to setup the test and execute the assertions: - `refs` — are for resolving used `$ref`'s on the faked schema - `throws` — test if the an error was expected, can be a boolean or string - `hasNot` — used for primitives, it will perform a `not.toContain()` test -- `hasProps` — -- `onlyProps` — +- `hasProps` — ensure given props exists on the generated value +- `onlyProps` — ensure given props matches the generated value - `type` — used for primitives, it will perform a `toHaveType()` test - `valid` — will test the generated json against the original schema - `equal` — will test equality for the given schema and the generated one - `repeat` — will execute the same test many times as given -- `seed` — -- `set` — -- `skip` — -- `only` — -- `count` — -- `length` — +- `seed` — provide the given seed to the `random()` generator +- `count` — will match arrays/strings length or object props, etc. +- `set` — configure given options through `jsf.option()` +- `skip` — skip individual tests +- `only` — run this test only + +> Use these tests as reference of how things works, if you found an edge-case please add it as test and open an issue for. -- GitLab