Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
json-schema-faker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fork
json-schema-faker
Commits
50ad7e9e
Commit
50ad7e9e
authored
6 years ago
by
Alvaro Cabrera Durán
Browse files
Options
Downloads
Patches
Plain Diff
Update TESTING info
parent
241cecce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/TESTING.md
+13
-9
13 additions, 9 deletions
docs/TESTING.md
with
13 additions
and
9 deletions
docs/TESTING.md
+
13
−
9
View file @
50ad7e9e
## 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.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment