Const
Optional
options: OptionsOptional
overrides: Partial<import * as fc from 'fast-check'
import { type } from 'arktype'
import { arkTest } from '@traversable/arktype-test'
const Json = arkTest.SeedGenerator({
include: ['null', 'boolean', 'number', 'string', 'array', 'object']
})
const [jsonNumber, jsonObject, anyJson] = [
fc.sample(Json.number, 1)[0],
fc.sample(Json.object, 1)[0],
fc.sample(Json['*'], 1)[0],
] as const
console.log(jsonNumber)
// => [200,[2.96e-322,1,null,false,true]]
console.log(jsonObject)
// => [7500,[["n;}289K~",[250,[null,null]]]]]
console.log(anyJson)
// => [250,[23,64]]
arkTest.SeedGenerator
Pseudo-random seed generator.
The generator supports a wide range of discoverable configuration options via the optional
options
argument.Many of those options are forwarded to the corresponding
fast-check
arbitrary.Note: support for
options.minDepth
is experimental. If you use it, be advised that even with a minimum depth of 1, the schemas produced will be quite large. Using this option in your CI/CD pipeline is not recommended.See also:
arkTest.SeedGenerator