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
146da6a7
Commit
146da6a7
authored
7 years ago
by
Alvaro Cabrera
Browse files
Options
Downloads
Patches
Plain Diff
Improve optionalsProbability tests; fix
parent
006c0902
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/schema/core/option/optionalsProbability.json
+75
-30
75 additions, 30 deletions
spec/schema/core/option/optionalsProbability.json
with
75 additions
and
30 deletions
spec/schema/core/option/optionalsProbability.json
+
75
−
30
View file @
146da6a7
[
{
"description"
:
"optionalsProbability option"
,
"schemas"
:
[
{
"type"
:
"object"
,
"properties"
:
{
"optionalProperty1"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty2"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty3"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty4"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty5"
:
{
"type"
:
"number"
,
"default"
:
1
}
}
}
],
"tests"
:
[
{
"description"
:
"should handle optionalsProbability option (default = 0) for objects"
,
"schema"
:
{
"type"
:
"object"
,
"properties"
:
{
"optionalProperty1"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty2"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty3"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty4"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty5"
:
{
"type"
:
"number"
,
"default"
:
1
}
}
},
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"equal"
:
{}
},
{
"description"
:
"should handle optionalsProbability option (= 1) for objects"
,
"schema"
:
{
"type"
:
"object"
,
"properties"
:
{
"optionalProperty1"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty2"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty3"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty4"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty5"
:
{
"type"
:
"number"
,
"default"
:
1
}
}
},
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"equal"
:
{
"optionalProperty1"
:
1
,
...
...
@@ -56,16 +50,7 @@
},
{
"description"
:
"should handle optionalsProbability option (= 0) overwritten by alwaysFakeOptionals for objects"
,
"schema"
:
{
"type"
:
"object"
,
"properties"
:
{
"optionalProperty1"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty2"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty3"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty4"
:
{
"type"
:
"number"
,
"default"
:
1
},
"optionalProperty5"
:
{
"type"
:
"number"
,
"default"
:
1
}
}
},
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"equal"
:
{
"optionalProperty1"
:
1
,
...
...
@@ -90,6 +75,66 @@
"valid"
:
true
,
"equal"
:
[
"a"
,
"a"
,
"a"
,
"a"
,
"a"
],
"require"
:
"core/option/optionalsProbabilityOverwritten"
},
{
"description"
:
"should generate just zero properties if optionalsProbability is 0%"
,
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"count"
:
0
,
"set"
:
{
"useDefaultValue"
:
true
,
"optionalsProbability"
:
0.0
}
},
{
"description"
:
"should generate just one property if optionalsProbability is 20%"
,
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"count"
:
1
,
"set"
:
{
"useDefaultValue"
:
true
,
"optionalsProbability"
:
0.2
}
},
{
"description"
:
"should generate just two properties if optionalsProbability is 40%"
,
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"count"
:
2
,
"set"
:
{
"useDefaultValue"
:
true
,
"optionalsProbability"
:
0.4
}
},
{
"description"
:
"should generate just three properties if optionalsProbability is 60%"
,
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"count"
:
3
,
"set"
:
{
"useDefaultValue"
:
true
,
"optionalsProbability"
:
0.6
}
},
{
"description"
:
"should generate just four properties if optionalsProbability is 80%"
,
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"count"
:
4
,
"set"
:
{
"useDefaultValue"
:
true
,
"optionalsProbability"
:
0.8
}
},
{
"description"
:
"should generate all properties if optionalsProbability is 100%"
,
"schema"
:
"schemas.0"
,
"valid"
:
true
,
"count"
:
5
,
"set"
:
{
"useDefaultValue"
:
true
,
"optionalsProbability"
:
1.0
}
}
]
}
...
...
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