From 7a6a5db50003e3a9d1f7329c318cef896d62cc08 Mon Sep 17 00:00:00 2001 From: Tomer Aberbach Date: Sun, 8 Dec 2024 15:21:15 -0500 Subject: [PATCH] feat: optional properties and formatting improvements --- src/arbitrary.ts | 4 +- src/components.ts | 301 +++++++++++++----- src/convert.ts | 48 +-- src/emitter.ts | 4 +- test/index.ts | 28 +- test/snapshots/array/arbitraries.js | 10 +- test/snapshots/array/samples.js | 2 +- test/snapshots/boolean/arbitraries.js | 2 +- test/snapshots/boolean/samples.js | 2 +- test/snapshots/bytes/arbitraries.js | 2 +- test/snapshots/bytes/samples.js | 2 +- test/snapshots/decimal/arbitraries.js | 10 +- test/snapshots/decimal/samples.js | 2 +- test/snapshots/decimal128/arbitraries.js | 10 +- test/snapshots/decimal128/samples.js | 2 +- test/snapshots/dictionary/arbitraries.js | 2 +- test/snapshots/dictionary/samples.js | 2 +- test/snapshots/empty/arbitraries.js | 1 - test/snapshots/empty/samples.js | 2 +- test/snapshots/enum/arbitraries.js | 6 +- test/snapshots/enum/samples.js | 4 +- test/snapshots/file-model/arbitraries.js | 4 +- test/snapshots/file-model/samples.js | 2 +- test/snapshots/file-namespace/arbitraries.js | 4 +- test/snapshots/file-namespace/samples.js | 2 +- test/snapshots/float32/arbitraries.js | 14 +- test/snapshots/float32/samples.js | 2 +- test/snapshots/float64/arbitraries.js | 10 +- test/snapshots/float64/samples.js | 2 +- test/snapshots/int16/arbitraries.js | 6 +- test/snapshots/int16/samples.js | 2 +- test/snapshots/int32/arbitraries.js | 10 +- test/snapshots/int32/samples.js | 2 +- test/snapshots/int64/arbitraries.js | 2 +- test/snapshots/int64/samples.js | 2 +- test/snapshots/int8/arbitraries.js | 6 +- test/snapshots/int8/samples.js | 2 +- test/snapshots/integer/arbitraries.js | 14 +- test/snapshots/integer/samples.js | 2 +- .../model-and-namespace/arbitraries.js | 8 +- test/snapshots/model-and-namespace/samples.js | 2 +- .../model-in-namespace/arbitraries.js | 6 +- test/snapshots/model-in-namespace/samples.js | 2 +- test/snapshots/model-is/arbitraries.js | 10 +- test/snapshots/model-is/samples.js | 2 +- .../model-optional-property/arbitraries.js | 33 ++ .../model-optional-property/samples.js | 83 +++++ test/snapshots/model-spread/arbitraries.js | 14 +- test/snapshots/model-spread/samples.js | 2 +- test/snapshots/model/arbitraries.js | 2 +- test/snapshots/model/samples.js | 2 +- .../arbitraries.js | 6 +- .../namespace-in-file-namespace/samples.js | 2 +- test/snapshots/namespace/arbitraries.js | 4 +- test/snapshots/namespace/samples.js | 2 +- test/snapshots/never/arbitraries.js | 8 +- test/snapshots/never/samples.js | 2 +- test/snapshots/null/arbitraries.js | 4 +- test/snapshots/null/samples.js | 2 +- test/snapshots/numeric/arbitraries.js | 10 +- test/snapshots/numeric/samples.js | 2 +- test/snapshots/safeint/arbitraries.js | 2 +- test/snapshots/safeint/samples.js | 2 +- test/snapshots/string/arbitraries.js | 10 +- test/snapshots/string/samples.js | 2 +- test/snapshots/union/arbitraries.js | 2 +- test/snapshots/union/samples.js | 2 +- test/snapshots/unknown/arbitraries.js | 4 +- test/snapshots/unknown/samples.js | 2 +- test/snapshots/void/arbitraries.js | 4 +- test/snapshots/void/samples.js | 2 +- 71 files changed, 487 insertions(+), 287 deletions(-) create mode 100644 test/snapshots/model-optional-property/arbitraries.js create mode 100644 test/snapshots/model-optional-property/samples.js diff --git a/src/arbitrary.ts b/src/arbitrary.ts index 2f59b1d..d259a94 100644 --- a/src/arbitrary.ts +++ b/src/arbitrary.ts @@ -57,7 +57,7 @@ export type BytesArbitrary = { export type EnumArbitrary = { type: `enum` - values: string[] + values: (string | number)[] } export type ArrayArbitrary = { @@ -80,7 +80,7 @@ export type UnionArbitrary = { export type RecordArbitrary = { type: `record` - properties: Map + properties: Map } export type MergedArbitrary = { diff --git a/src/components.ts b/src/components.ts index e92f7d0..79b33d7 100644 --- a/src/components.ts +++ b/src/components.ts @@ -2,17 +2,27 @@ import { entries, filter, + first, get, + join, + keys, map, minBy, pipe, reduce, toArray, toMap, + toObject, + toSet, } from 'lfi' import * as ay from '@alloy-js/core/stc' import * as ts from '@alloy-js/typescript/stc' -import { join as ayJoin, code, refkey } from '@alloy-js/core' +import { + join as ayJoin, + mapJoin as ayMapJoin, + code, + refkey, +} from '@alloy-js/core' import type { Child, Children } from '@alloy-js/core' import type { Arbitrary, @@ -96,15 +106,25 @@ const NestedArbitraryNamespace = ({ }: { namespace: ArbitraryNamespace sharedArbitraries: ReadonlySet -}): Child => - ts.ObjectExpression().children( +}): Child => { + if ( + namespace.namespaces.length === 0 && + namespace.nameToArbitrary.size === 0 + ) { + return `{}` + } + + return ts.ObjectExpression().children( ayJoin( [ ...map( namespace => ts.ObjectProperty({ name: namespace.name, - value: code`${NestedArbitraryNamespace({ namespace, sharedArbitraries })},`, + value: code`${NestedArbitraryNamespace({ + namespace, + sharedArbitraries, + })},`, }), namespace.namespaces, ), @@ -120,6 +140,7 @@ const NestedArbitraryNamespace = ({ { joiner: `\n\n` }, ), ) +} const Arbitrary = ({ arbitrary, @@ -238,12 +259,14 @@ const NumberArbitrary = ({ arbitraryMax = max.normalize(arbitraryMax) } - return code`fc.${name}(${Options({ - properties: new Map([ - [`min`, arbitraryMin], - [`max`, arbitraryMax], - ]), - })})` + return CallExpression({ + name: `fc.${name}`, + args: [ + ObjectExpression({ + properties: { min: arbitraryMin, max: arbitraryMax }, + }), + ], + }) } const BigIntArbitrary = ({ @@ -251,29 +274,47 @@ const BigIntArbitrary = ({ }: { arbitrary: BigIntArbitrary }): Child => - code`fc.bigInt(${Options({ - properties: new Map([ - [`min`, arbitrary.min == null ? null : `${arbitrary.min}n`], - [`max`, arbitrary.max == null ? null : `${arbitrary.max}n`], - ]), - })})` + CallExpression({ + name: `fc.bigInt`, + args: [ + ObjectExpression({ + properties: { + min: arbitrary.min == null ? null : `${arbitrary.min}n`, + max: arbitrary.max == null ? null : `${arbitrary.max}n`, + }, + }), + ], + }) const StringArbitrary = ({ arbitrary, }: { arbitrary: StringArbitrary }): Child => - code`fc.string(${Options({ - properties: new Map([ - [`minLength`, arbitrary.minLength], - [`maxLength`, arbitrary.maxLength], - ]), - })})` + CallExpression({ + name: `fc.string`, + args: [ + ObjectExpression({ + properties: { + minLength: arbitrary.minLength, + maxLength: arbitrary.maxLength, + }, + }), + ], + }) const BytesArbitrary = (): Child => code`fc.uint8Array()` const EnumArbitrary = ({ arbitrary }: { arbitrary: EnumArbitrary }): Child => - code`fc.constantFrom(${arbitrary.values.join(`, `)})` + CallExpression({ + name: `fc.constantFrom`, + args: arbitrary.values.map(value => + typeof value === `string` + ? StringLiteral({ string: value }) + : String(value), + ), + oneLine: true, + }) const ArrayArbitrary = ({ arbitrary, @@ -281,20 +322,21 @@ const ArrayArbitrary = ({ }: { arbitrary: ArrayArbitrary sharedArbitraries: ReadonlySet -}): Child => { - const options = Options({ - properties: new Map([ - [`minLength`, arbitrary.minItems], - [`maxLength`, arbitrary.maxItems], - ]), +}): Child => + CallExpression({ + name: `fc.array`, + args: [ + Arbitrary({ arbitrary: arbitrary.value, sharedArbitraries }), + ObjectExpression({ + properties: { + minLength: arbitrary.minItems, + maxLength: arbitrary.maxItems, + }, + }), + ], + oneLine: true, }) - return code`fc.array(${Arbitrary({ - arbitrary: arbitrary.value, - sharedArbitraries, - })}${options ? code`, ${options}` : ``})` -} - const DictionaryArbitrary = ({ arbitrary, sharedArbitraries, @@ -304,7 +346,11 @@ const DictionaryArbitrary = ({ }): Child => { const Key = Arbitrary({ arbitrary: arbitrary.key, sharedArbitraries }) const Value = Arbitrary({ arbitrary: arbitrary.value, sharedArbitraries }) - return code`fc.dictionary(${Key}, ${Value})` + return CallExpression({ + name: `fc.dictionary`, + args: [Key, Value], + oneLine: true, + }) } const UnionArbitrary = ({ @@ -314,16 +360,12 @@ const UnionArbitrary = ({ arbitrary: UnionArbitrary sharedArbitraries: ReadonlySet }): Child => - code`fc.oneof(\n${ay - .Indent() - .children( - ayJoin( - arbitrary.variants.map( - variant => - code`${Arbitrary({ arbitrary: variant, sharedArbitraries })},`, - ), - ), - )}\n)` + CallExpression({ + name: `fc.oneof`, + args: arbitrary.variants.map(variant => + Arbitrary({ arbitrary: variant, sharedArbitraries }), + ), + }) const RecordArbitrary = ({ arbitrary, @@ -331,18 +373,47 @@ const RecordArbitrary = ({ }: { arbitrary: RecordArbitrary sharedArbitraries: ReadonlySet -}): Child => - code`fc.record(${Options({ - properties: pipe( - arbitrary.properties, - map(([name, arbitrary]) => [ - name, - Arbitrary({ arbitrary, sharedArbitraries }), - ]), - reduce(toMap()), - ), - emitEmpty: true, - })})` +}): Child => { + const requiredProperties = pipe( + arbitrary.properties, + filter(([, property]) => property.required), + map(([name]) => name), + reduce(toSet()), + ) + + return CallExpression({ + name: `fc.record`, + args: [ + ObjectExpression({ + properties: pipe( + arbitrary.properties, + map(([name, { arbitrary }]) => [ + name, + Arbitrary({ arbitrary, sharedArbitraries }), + ]), + reduce(toObject()), + ), + emitEmpty: true, + }), + requiredProperties.size === arbitrary.properties.size + ? null + : ObjectExpression({ + properties: + requiredProperties.size === 0 + ? { withDeletedKeys: `true` } + : { + requiredKeys: ArrayExpression({ + values: pipe( + requiredProperties, + map(property => StringLiteral({ string: property })), + reduce(toArray()), + ), + }), + }, + }), + ], + }) +} const MergedArbitrary = ({ arbitrary, @@ -352,49 +423,105 @@ const MergedArbitrary = ({ sharedArbitraries: ReadonlySet }): Child => code` fc - .tuple( - ${ayJoin( - arbitrary.arbitraries.map( - arbitrary => code`${Arbitrary({ arbitrary, sharedArbitraries })},`, - ), - { joiner: `\n` }, - )} - ) + ${CallExpression({ + name: `.tuple`, + args: arbitrary.arbitraries.map(arbitrary => + Arbitrary({ arbitrary, sharedArbitraries }), + ), + })} .map(values => Object.assign(...values)) ` -const Options = ({ +const ArrayExpression = ({ values }: { values: Child[] }): Child => + code`[${ayJoin(values, { joiner: `, ` })}]` + +const ObjectExpression = ({ properties, emitEmpty = false, }: { - properties: Map + properties: Record emitEmpty?: boolean -}) => { +}): Child => { const filteredProperties = pipe( - properties, + entries(properties), filter(([, value]) => value != null), reduce(toMap()), ) - if (filteredProperties.size === 0 && !emitEmpty) { - return `` + switch (filteredProperties.size) { + case 0: + return emitEmpty ? `{}` : `` + case 1: { + const [name, value] = get(first(filteredProperties)) + return code`{ ${ts.ObjectProperty({ + name, + // https://github.com/alloy-framework/alloy/issues/42 + value: typeof value === `number` ? String(value) : value, + })} }` + } + default: + return ts.ObjectExpression().children( + ayJoin( + pipe( + filteredProperties, + map( + ([name, value]) => + code`${ts.ObjectProperty({ + name, + // https://github.com/alloy-framework/alloy/issues/42 + value: typeof value === `number` ? String(value) : value, + })},\n`, + ), + reduce(toArray()), + ), + ), + ) } +} - return ts.ObjectExpression().children( - ayJoin( - pipe( - filteredProperties, - map( - ([name, value]) => - code`${ts.ObjectProperty({ - name, - // https://github.com/alloy-framework/alloy/issues/42 - value: typeof value === `number` ? String(value) : value, - })},\n`, - ), - reduce(toArray()), - ), +const CallExpression = ({ + name, + args, + oneLine = false, +}: { + name: string + args: Child[] + oneLine?: boolean +}): Child => { + args = filterChildren(args) + return !oneLine && args.length >= 2 + ? code` + ${name}( + ${ayMapJoin(args, arg => code`${arg},`, { joiner: `\n` })} + ) + ` + : code`${name}(${ayJoin(args, { joiner: `, ` })})` +} + +const StringLiteral = ({ string }: { string: string }): Child => + `'${string.replace( + new RegExp( + `[${pipe( + keys(escapes), + map(c => (c === `\\` ? `\\\\` : c)), + join(``), + )}]`, + `gu`, ), - ) + c => escapes[c]!, + )}'` + +const escapes: Record = { + "'": `\\'`, + '\\': `\\\\`, + '\b': `\\b`, + '\f': `\\f`, + '\n': `\\n`, + '\r': `\\r`, + '\t': `\\t`, + '\v': `\\x0B`, } +const filterChildren = (children: Child[]): Child[] => + children.filter(child => child != null && child !== `` && child !== false) + export default ArbitraryFile diff --git a/src/convert.ts b/src/convert.ts index ccfa246..4a4a0c7 100644 --- a/src/convert.ts +++ b/src/convert.ts @@ -26,7 +26,6 @@ import { entries, filter, flatMap, - flatten, map, pipe, reduce, @@ -44,7 +43,6 @@ import type { ArrayArbitrary, BigIntArbitrary, DictionaryArbitrary, - IntrinsicArbitrary, NumberArbitrary, RecordArbitrary, ReferenceArbitrary, @@ -122,14 +120,16 @@ const convertType = ( throw new Error(`Unhandled type: ${type.kind}`) } -const convertIntrinsic = (intrinsic: IntrinsicType): IntrinsicArbitrary => { +const convertIntrinsic = (intrinsic: IntrinsicType): Arbitrary => { switch (intrinsic.name) { case `null`: return memoize({ type: `null` }) case `void`: return memoize({ type: `undefined` }) case `never`: - return memoize({ type: `never` }) + // Ref this because it's verbose so it's nice to extract a `const never` + // variable if it's referenced more than once. + return ref(`never`, memoize({ type: `never` })) case `unknown`: return memoize({ type: `unknown` }) case `ErrorType`: @@ -227,9 +227,7 @@ const convertEnum = ($enum: Enum): Arbitrary => type: `enum`, values: pipe( $enum.members, - map(([, { name, value }]) => - JSON.stringify(value === undefined ? name : value), - ), + map(([, { name, value }]) => (value === undefined ? name : value)), reduce(toArray()), ), }), @@ -244,14 +242,11 @@ const convertUnion = ( type: `union`, variants: pipe( union.variants, - map(([, { type, name }]) => - ref( - String(name), - convertType(program, type, { - ...constraints, - ...getConstraints(program, union), - }), - ), + map(([, { type }]) => + convertType(program, type, { + ...constraints, + ...getConstraints(program, union), + }), ), reduce(toArray()), ), @@ -367,13 +362,13 @@ const convertRecord = ( properties, map(([name, property]) => [ name, - ref( - name, - convertType(program, property.type, { + { + arbitrary: convertType(program, property.type, { ...constraints, ...getConstraints(program, property), }), - ), + required: !property.optional, + }, ]), reduce(toMap()), ), @@ -446,7 +441,13 @@ const getArbitraryKey = (arbitrary: Arbitrary): ArbitraryKey => { case `union`: return keyalesce([arbitrary.type, ...arbitrary.variants]) case `record`: - return keyalesce([arbitrary.type, ...flatten(arbitrary.properties)]) + return keyalesce([ + arbitrary.type, + ...flatMap( + ([name, { arbitrary, required }]) => [name, arbitrary, required], + arbitrary.properties, + ), + ]) case `merged`: return keyalesce([arbitrary.type, ...arbitrary.arbitraries]) case `reference`: @@ -542,7 +543,12 @@ const getDirectArbitraryDependencies = ( case `union`: return new Set(arbitrary.variants) case `record`: - return new Set(values(arbitrary.properties)) + return new Set( + pipe( + values(arbitrary.properties), + map(property => property.arbitrary), + ), + ) case `merged`: return new Set(arbitrary.arbitraries) case `reference`: diff --git a/src/emitter.ts b/src/emitter.ts index d3f4264..f6bf6de 100644 --- a/src/emitter.ts +++ b/src/emitter.ts @@ -11,9 +11,11 @@ export async function $onEmit(context: EmitContext): Promise { return } - const { path, contents } = render( + let { path, contents } = render( ArbitraryFile(convertProgram(context.program)), ).contents[0]! as OutputFile + contents = `${contents.trim()}\n` + await emitFile(context.program, { path: resolvePath(context.emitterOutputDir, path), content: contents, diff --git a/test/index.ts b/test/index.ts index 51dcb29..8c381de 100644 --- a/test/index.ts +++ b/test/index.ts @@ -453,6 +453,30 @@ test.each([ } `, }, + { + name: `model-optional-property`, + code: ` + model EmptyModel {} + + model AllRequiredModel { + a: int32, + b: string, + c: string + } + + model AllOptionalModel { + a?: int32, + b?: string, + c?: int64 + } + + model SomeOptionalModel { + a?: int32, + b: string, + c?: int64 + } + `, + }, ] satisfies TestCase[])(`$name`, async ({ name, code }) => { const snapshotPath = `./snapshots/${name}` const arbitrariesPath = `${snapshotPath}/arbitraries.js` @@ -482,7 +506,9 @@ const emitArbitrarySamples = async (code: string): Promise => { unknown > const arbitrarySamples = sampleArbitraries(arbitraries) - return `export const samples = ${jsesc(arbitrarySamples, { compact: false })};` + return `export const samples = ${jsesc(arbitrarySamples, { + compact: false, + })};\n` } const sampleArbitraries = ( diff --git a/test/snapshots/array/arbitraries.js b/test/snapshots/array/arbitraries.js index 5958fee..0c3b39b 100644 --- a/test/snapshots/array/arbitraries.js +++ b/test/snapshots/array/arbitraries.js @@ -2,17 +2,13 @@ import * as fc from 'fast-check'; export const $Array = fc.array(fc.string()); -export const MinItemsArray = fc.array(fc.string(), { - minLength: 3, -}); +export const MinItemsArray = fc.array(fc.string(), { minLength: 3 }); export const Min0ItemsArray = fc.array(fc.string()); -export const MaxItemsArray = fc.array(fc.string(), { - maxLength: 12, -}); +export const MaxItemsArray = fc.array(fc.string(), { maxLength: 12 }); export const MinMaxItemsArray = fc.array(fc.string(), { minLength: 3, maxLength: 12, -}); \ No newline at end of file +}); diff --git a/test/snapshots/array/samples.js b/test/snapshots/array/samples.js index 1a8c23a..33868cc 100644 --- a/test/snapshots/array/samples.js +++ b/test/snapshots/array/samples.js @@ -163,4 +163,4 @@ export const samples = { '@syNc' ] ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/boolean/arbitraries.js b/test/snapshots/boolean/arbitraries.js index 89ee495..7a27b98 100644 --- a/test/snapshots/boolean/arbitraries.js +++ b/test/snapshots/boolean/arbitraries.js @@ -1,3 +1,3 @@ import * as fc from 'fast-check'; -export const Boolean = fc.boolean(); \ No newline at end of file +export const Boolean = fc.boolean(); diff --git a/test/snapshots/boolean/samples.js b/test/snapshots/boolean/samples.js index c94000f..3ef365f 100644 --- a/test/snapshots/boolean/samples.js +++ b/test/snapshots/boolean/samples.js @@ -6,4 +6,4 @@ export const samples = { false, false ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/bytes/arbitraries.js b/test/snapshots/bytes/arbitraries.js index 7c9e0eb..57a95e9 100644 --- a/test/snapshots/bytes/arbitraries.js +++ b/test/snapshots/bytes/arbitraries.js @@ -1,3 +1,3 @@ import * as fc from 'fast-check'; -export const Bytes = fc.uint8Array(); \ No newline at end of file +export const Bytes = fc.uint8Array(); diff --git a/test/snapshots/bytes/samples.js b/test/snapshots/bytes/samples.js index 268171e..765f1bd 100644 --- a/test/snapshots/bytes/samples.js +++ b/test/snapshots/bytes/samples.js @@ -25,4 +25,4 @@ export const samples = { ]), new Uint8Array() ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/decimal/arbitraries.js b/test/snapshots/decimal/arbitraries.js index 55dbd38..c66953a 100644 --- a/test/snapshots/decimal/arbitraries.js +++ b/test/snapshots/decimal/arbitraries.js @@ -2,15 +2,11 @@ import * as fc from 'fast-check'; export const Decimal = fc.double(); -export const MinValueDecimal = fc.double({ - min: -3.4e+39, -}); +export const MinValueDecimal = fc.double({ min: -3.4e+39 }); -export const MaxValueDecimal = fc.double({ - max: 3.4e+39, -}); +export const MaxValueDecimal = fc.double({ max: 3.4e+39 }); export const MinMaxValueDecimal = fc.double({ min: -3.4e+39, max: 3.4e+39, -}); \ No newline at end of file +}); diff --git a/test/snapshots/decimal/samples.js b/test/snapshots/decimal/samples.js index 477a3b0..69845a6 100644 --- a/test/snapshots/decimal/samples.js +++ b/test/snapshots/decimal/samples.js @@ -27,4 +27,4 @@ export const samples = { 2.47e-322, -3.3999999999999866e+39 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/decimal128/arbitraries.js b/test/snapshots/decimal128/arbitraries.js index c57a04f..091258f 100644 --- a/test/snapshots/decimal128/arbitraries.js +++ b/test/snapshots/decimal128/arbitraries.js @@ -2,15 +2,11 @@ import * as fc from 'fast-check'; export const Decimal128 = fc.double(); -export const MinValueDecimal128 = fc.double({ - min: -3.4e+39, -}); +export const MinValueDecimal128 = fc.double({ min: -3.4e+39 }); -export const MaxValueDecimal128 = fc.double({ - max: 3.4e+39, -}); +export const MaxValueDecimal128 = fc.double({ max: 3.4e+39 }); export const MinMaxValueDecimal128 = fc.double({ min: -3.4e+39, max: 3.4e+39, -}); \ No newline at end of file +}); diff --git a/test/snapshots/decimal128/samples.js b/test/snapshots/decimal128/samples.js index 49c1e50..94afb12 100644 --- a/test/snapshots/decimal128/samples.js +++ b/test/snapshots/decimal128/samples.js @@ -27,4 +27,4 @@ export const samples = { 2.47e-322, -3.3999999999999866e+39 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/dictionary/arbitraries.js b/test/snapshots/dictionary/arbitraries.js index d4b6d14..cdf851b 100644 --- a/test/snapshots/dictionary/arbitraries.js +++ b/test/snapshots/dictionary/arbitraries.js @@ -1,3 +1,3 @@ import * as fc from 'fast-check'; -export const Dictionary = fc.dictionary(fc.string(), fc.integer()); \ No newline at end of file +export const Dictionary = fc.dictionary(fc.string(), fc.integer()); diff --git a/test/snapshots/dictionary/samples.js b/test/snapshots/dictionary/samples.js index d94ba5e..5d38b85 100644 --- a/test/snapshots/dictionary/samples.js +++ b/test/snapshots/dictionary/samples.js @@ -25,4 +25,4 @@ export const samples = { }, {} ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/empty/arbitraries.js b/test/snapshots/empty/arbitraries.js index c7e8fe5..9048ae7 100644 --- a/test/snapshots/empty/arbitraries.js +++ b/test/snapshots/empty/arbitraries.js @@ -1,2 +1 @@ import * as fc from 'fast-check'; - diff --git a/test/snapshots/empty/samples.js b/test/snapshots/empty/samples.js index c4c009e..83c546a 100644 --- a/test/snapshots/empty/samples.js +++ b/test/snapshots/empty/samples.js @@ -1 +1 @@ -export const samples = {}; \ No newline at end of file +export const samples = {}; diff --git a/test/snapshots/enum/arbitraries.js b/test/snapshots/enum/arbitraries.js index 7c5840c..3258845 100644 --- a/test/snapshots/enum/arbitraries.js +++ b/test/snapshots/enum/arbitraries.js @@ -1,7 +1,7 @@ import * as fc from 'fast-check'; -export const $Enum = fc.constantFrom("A", "B", "C", "D"); +export const $Enum = fc.constantFrom('A', 'B', 'C', 'D'); -export const StringEnum = fc.constantFrom("a", "b", "c", "d"); +export const StringEnum = fc.constantFrom('a', 'b', 'c', 'd'); -export const NumberEnum = fc.constantFrom(1, 2, 3.14, null); \ No newline at end of file +export const NumberEnum = fc.constantFrom(1, 2, 3.14, Infinity); diff --git a/test/snapshots/enum/samples.js b/test/snapshots/enum/samples.js index 73f9e4d..810fa6a 100644 --- a/test/snapshots/enum/samples.js +++ b/test/snapshots/enum/samples.js @@ -8,7 +8,7 @@ export const samples = { ], 'NumberEnum': [ 3.14, - null, + Infinity, 2, 3.14, 1 @@ -20,4 +20,4 @@ export const samples = { 'c', 'a' ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/file-model/arbitraries.js b/test/snapshots/file-model/arbitraries.js index a49ee5a..85248d5 100644 --- a/test/snapshots/file-model/arbitraries.js +++ b/test/snapshots/file-model/arbitraries.js @@ -1,5 +1,3 @@ import * as fc from 'fast-check'; -export const Pet = fc.record({ - -}); \ No newline at end of file +export const Pet = fc.record({}); diff --git a/test/snapshots/file-model/samples.js b/test/snapshots/file-model/samples.js index 116c594..e52d175 100644 --- a/test/snapshots/file-model/samples.js +++ b/test/snapshots/file-model/samples.js @@ -6,4 +6,4 @@ export const samples = { {}, {} ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/file-namespace/arbitraries.js b/test/snapshots/file-namespace/arbitraries.js index 3a939b2..8b257aa 100644 --- a/test/snapshots/file-namespace/arbitraries.js +++ b/test/snapshots/file-namespace/arbitraries.js @@ -1,5 +1,3 @@ import * as fc from 'fast-check'; -export const PetStore = { - -}; \ No newline at end of file +export const PetStore = {}; diff --git a/test/snapshots/file-namespace/samples.js b/test/snapshots/file-namespace/samples.js index 8327c8a..6cae294 100644 --- a/test/snapshots/file-namespace/samples.js +++ b/test/snapshots/file-namespace/samples.js @@ -1,3 +1,3 @@ export const samples = { 'PetStore': {} -}; \ No newline at end of file +}; diff --git a/test/snapshots/float32/arbitraries.js b/test/snapshots/float32/arbitraries.js index b2dcafc..4fc22ed 100644 --- a/test/snapshots/float32/arbitraries.js +++ b/test/snapshots/float32/arbitraries.js @@ -2,21 +2,15 @@ import * as fc from 'fast-check'; export const Float32 = fc.float(); -export const MinValueFloat32 = fc.float({ - min: -3.140000104904175, -}); +export const MinValueFloat32 = fc.float({ min: -3.140000104904175 }); -export const MinValue0Float32 = fc.float({ - min: 0, -}); +export const MinValue0Float32 = fc.float({ min: 0 }); -export const MaxValueFloat32 = fc.float({ - max: 3.140000104904175, -}); +export const MaxValueFloat32 = fc.float({ max: 3.140000104904175 }); export const MinMaxValueFloat32 = fc.float({ min: -3.140000104904175, max: 3.140000104904175, }); -export const RedundantlyMinMaxValueFloat32 = fc.float(); \ No newline at end of file +export const RedundantlyMinMaxValueFloat32 = fc.float(); diff --git a/test/snapshots/float32/samples.js b/test/snapshots/float32/samples.js index a6e73e7..94ee3dd 100644 --- a/test/snapshots/float32/samples.js +++ b/test/snapshots/float32/samples.js @@ -41,4 +41,4 @@ export const samples = { 4.0637655465419695e-44, -3.4028232635611926e+38 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/float64/arbitraries.js b/test/snapshots/float64/arbitraries.js index 1472cf2..8143dcd 100644 --- a/test/snapshots/float64/arbitraries.js +++ b/test/snapshots/float64/arbitraries.js @@ -2,15 +2,11 @@ import * as fc from 'fast-check'; export const Float64 = fc.double(); -export const MinValueFloat64 = fc.double({ - min: -3.4e+39, -}); +export const MinValueFloat64 = fc.double({ min: -3.4e+39 }); -export const MaxValueFloat64 = fc.double({ - max: 3.4e+39, -}); +export const MaxValueFloat64 = fc.double({ max: 3.4e+39 }); export const MinMaxValueFloat64 = fc.double({ min: -3.4e+39, max: 3.4e+39, -}); \ No newline at end of file +}); diff --git a/test/snapshots/float64/samples.js b/test/snapshots/float64/samples.js index b8fc63f..f110eea 100644 --- a/test/snapshots/float64/samples.js +++ b/test/snapshots/float64/samples.js @@ -27,4 +27,4 @@ export const samples = { 2.47e-322, -3.3999999999999866e+39 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/int16/arbitraries.js b/test/snapshots/int16/arbitraries.js index cc6427e..3c61153 100644 --- a/test/snapshots/int16/arbitraries.js +++ b/test/snapshots/int16/arbitraries.js @@ -10,9 +10,7 @@ export const MinValueInt16 = fc.integer({ max: 32767, }); -export const Min0ValueInt16 = fc.nat({ - max: 32767, -}); +export const Min0ValueInt16 = fc.nat({ max: 32767 }); export const MaxValueInt16 = fc.integer({ min: -32768, @@ -27,4 +25,4 @@ export const MinMaxValueInt16 = fc.integer({ export const RedundantlyMinMaxValueInt16 = fc.integer({ min: -32768, max: 32767, -}); \ No newline at end of file +}); diff --git a/test/snapshots/int16/samples.js b/test/snapshots/int16/samples.js index 7c50cd2..2ef84a7 100644 --- a/test/snapshots/int16/samples.js +++ b/test/snapshots/int16/samples.js @@ -41,4 +41,4 @@ export const samples = { -5, -32762 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/int32/arbitraries.js b/test/snapshots/int32/arbitraries.js index 64eb1c5..1ad0ebc 100644 --- a/test/snapshots/int32/arbitraries.js +++ b/test/snapshots/int32/arbitraries.js @@ -2,19 +2,15 @@ import * as fc from 'fast-check'; export const Int32 = fc.integer(); -export const MinValueInt32 = fc.integer({ - min: -40000, -}); +export const MinValueInt32 = fc.integer({ min: -40000 }); export const Min0ValueInt32 = fc.nat(); -export const MaxValueInt32 = fc.integer({ - max: 40000, -}); +export const MaxValueInt32 = fc.integer({ max: 40000 }); export const MinMaxValueInt32 = fc.integer({ min: -40000, max: 40000, }); -export const RedundantlyMinMaxValueInt32 = fc.integer(); \ No newline at end of file +export const RedundantlyMinMaxValueInt32 = fc.integer(); diff --git a/test/snapshots/int32/samples.js b/test/snapshots/int32/samples.js index b83dc53..e10a034 100644 --- a/test/snapshots/int32/samples.js +++ b/test/snapshots/int32/samples.js @@ -41,4 +41,4 @@ export const samples = { -25, -2147483626 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/int64/arbitraries.js b/test/snapshots/int64/arbitraries.js index 69e686c..5e2c091 100644 --- a/test/snapshots/int64/arbitraries.js +++ b/test/snapshots/int64/arbitraries.js @@ -13,4 +13,4 @@ export const MinValueInt64 = fc.bigInt({ export const MaxValueInt64 = fc.bigInt({ min: -9223372036854775808n, max: 2147483650n, -}); \ No newline at end of file +}); diff --git a/test/snapshots/int64/samples.js b/test/snapshots/int64/samples.js index 560567c..4083baa 100644 --- a/test/snapshots/int64/samples.js +++ b/test/snapshots/int64/samples.js @@ -20,4 +20,4 @@ export const samples = { 2147483660n, 9223372036854775790n ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/int8/arbitraries.js b/test/snapshots/int8/arbitraries.js index 6ae87c8..e63f921 100644 --- a/test/snapshots/int8/arbitraries.js +++ b/test/snapshots/int8/arbitraries.js @@ -10,9 +10,7 @@ export const MinValueInt8 = fc.integer({ max: 127, }); -export const Min0ValueInt8 = fc.nat({ - max: 127, -}); +export const Min0ValueInt8 = fc.nat({ max: 127 }); export const MaxValueInt8 = fc.integer({ min: -128, @@ -27,4 +25,4 @@ export const MinMaxValueInt8 = fc.integer({ export const RedundantlyMinMaxValueInt8 = fc.integer({ min: -128, max: 127, -}); \ No newline at end of file +}); diff --git a/test/snapshots/int8/samples.js b/test/snapshots/int8/samples.js index 8dc5102..1775dfb 100644 --- a/test/snapshots/int8/samples.js +++ b/test/snapshots/int8/samples.js @@ -41,4 +41,4 @@ export const samples = { -7, -122 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/integer/arbitraries.js b/test/snapshots/integer/arbitraries.js index 92ea2b4..806de54 100644 --- a/test/snapshots/integer/arbitraries.js +++ b/test/snapshots/integer/arbitraries.js @@ -2,19 +2,13 @@ import * as fc from 'fast-check'; export const Integer = fc.bigInt(); -export const MinValueInteger = fc.bigInt({ - min: 92233720368547758000n, -}); +export const MinValueInteger = fc.bigInt({ min: 92233720368547758000n }); -export const MinValue0Integer = fc.bigInt({ - min: 0n, -}); +export const MinValue0Integer = fc.bigInt({ min: 0n }); -export const MaxValueInteger = fc.bigInt({ - max: 922337203685477580000n, -}); +export const MaxValueInteger = fc.bigInt({ max: 922337203685477580000n }); export const MinMaxValueInteger = fc.bigInt({ min: 92233720368547758000n, max: 922337203685477580000n, -}); \ No newline at end of file +}); diff --git a/test/snapshots/integer/samples.js b/test/snapshots/integer/samples.js index 606db8f..8135239 100644 --- a/test/snapshots/integer/samples.js +++ b/test/snapshots/integer/samples.js @@ -34,4 +34,4 @@ export const samples = { 92233720368547758070n, 57896044618658097711785492504343953935142051505843743591555761930783128819954n ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/model-and-namespace/arbitraries.js b/test/snapshots/model-and-namespace/arbitraries.js index 0bba384..800ab56 100644 --- a/test/snapshots/model-and-namespace/arbitraries.js +++ b/test/snapshots/model-and-namespace/arbitraries.js @@ -1,9 +1,5 @@ import * as fc from 'fast-check'; -export const PetStore = { - -}; +export const PetStore = {}; -export const Pet = fc.record({ - -}); \ No newline at end of file +export const Pet = fc.record({}); diff --git a/test/snapshots/model-and-namespace/samples.js b/test/snapshots/model-and-namespace/samples.js index f9f64b8..60289a5 100644 --- a/test/snapshots/model-and-namespace/samples.js +++ b/test/snapshots/model-and-namespace/samples.js @@ -7,4 +7,4 @@ export const samples = { {} ], 'PetStore': {} -}; \ No newline at end of file +}; diff --git a/test/snapshots/model-in-namespace/arbitraries.js b/test/snapshots/model-in-namespace/arbitraries.js index d788832..8b794c2 100644 --- a/test/snapshots/model-in-namespace/arbitraries.js +++ b/test/snapshots/model-in-namespace/arbitraries.js @@ -1,7 +1,5 @@ import * as fc from 'fast-check'; export const PetStore = { - Pet: fc.record({ - - }), -}; \ No newline at end of file + Pet: fc.record({}), +}; diff --git a/test/snapshots/model-in-namespace/samples.js b/test/snapshots/model-in-namespace/samples.js index 061b605..0aabddd 100644 --- a/test/snapshots/model-in-namespace/samples.js +++ b/test/snapshots/model-in-namespace/samples.js @@ -8,4 +8,4 @@ export const samples = { {} ] } -}; \ No newline at end of file +}; diff --git a/test/snapshots/model-is/arbitraries.js b/test/snapshots/model-is/arbitraries.js index 8c053ea..b510d14 100644 --- a/test/snapshots/model-is/arbitraries.js +++ b/test/snapshots/model-is/arbitraries.js @@ -1,16 +1,12 @@ import * as fc from 'fast-check'; -export const Model1 = fc.record({ - a: fc.integer(), -}); +export const Model1 = fc.record({ a: fc.integer() }); export const Model2 = Model1; export const Model3 = fc .tuple( Model1, - fc.record({ - b: fc.string(), - }), + fc.record({ b: fc.string() }), ) - .map(values => Object.assign(...values)); \ No newline at end of file + .map(values => Object.assign(...values)); diff --git a/test/snapshots/model-is/samples.js b/test/snapshots/model-is/samples.js index c340bbd..4e3a43a 100644 --- a/test/snapshots/model-is/samples.js +++ b/test/snapshots/model-is/samples.js @@ -55,4 +55,4 @@ export const samples = { 'b': 'J' } ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/model-optional-property/arbitraries.js b/test/snapshots/model-optional-property/arbitraries.js new file mode 100644 index 0000000..c3cce06 --- /dev/null +++ b/test/snapshots/model-optional-property/arbitraries.js @@ -0,0 +1,33 @@ +import * as fc from 'fast-check'; + +export const EmptyModel = fc.record({}); + +export const AllRequiredModel = fc.record({ + a: fc.integer(), + b: fc.string(), + c: fc.string(), +}); + +export const AllOptionalModel = fc.record( + { + a: fc.integer(), + b: fc.string(), + c: fc.bigInt({ + min: -9223372036854775808n, + max: 9223372036854775807n, + }), + }, + { withDeletedKeys: true }, +); + +export const SomeOptionalModel = fc.record( + { + a: fc.integer(), + b: fc.string(), + c: fc.bigInt({ + min: -9223372036854775808n, + max: 9223372036854775807n, + }), + }, + { requiredKeys: ['b'] }, +); diff --git a/test/snapshots/model-optional-property/samples.js b/test/snapshots/model-optional-property/samples.js new file mode 100644 index 0000000..02d430e --- /dev/null +++ b/test/snapshots/model-optional-property/samples.js @@ -0,0 +1,83 @@ +export const samples = { + 'AllOptionalModel': [ + { + 'a': -2 + }, + { + 'a': 2147483646, + 'b': '', + 'c': 6896479819535740518n + }, + { + 'a': -11, + 'b': 'S 5cRF', + 'c': 19n + }, + { + 'c': 10n + }, + { + 'a': 542422934, + 'b': 'Q1 "~g', + 'c': 14n + } + ], + 'AllRequiredModel': [ + { + 'a': 9, + 'b': 'LZy\\;m', + 'c': ')0#E' + }, + { + 'a': -994490854, + 'b': '__proto__', + 'c': '$' + }, + { + 'a': -1536816376, + 'b': 'S', + 'c': 'c' + }, + { + 'a': -25, + 'b': '0&k& #FFD', + 'c': '~' + }, + { + 'a': -2147483626, + 'b': 'J', + 'c': 'p % caller' + } + ], + 'EmptyModel': [ + {}, + {}, + {}, + {}, + {} + ], + 'SomeOptionalModel': [ + { + 'a': -2, + 'b': '%', + 'c': 6005499612257245482n + }, + { + 'a': 2147483646, + 'b': '2Spc0sZ', + 'c': 7n + }, + { + 'a': -11, + 'b': 'wS 5' + }, + { + 'b': '', + 'c': 7687182948790468904n + }, + { + 'a': 542422934, + 'b': 'J' + } + ] +}; diff --git a/test/snapshots/model-spread/arbitraries.js b/test/snapshots/model-spread/arbitraries.js index 37902c1..73ca3b6 100644 --- a/test/snapshots/model-spread/arbitraries.js +++ b/test/snapshots/model-spread/arbitraries.js @@ -1,20 +1,14 @@ import * as fc from 'fast-check'; -export const Model2 = fc.record({ - b: fc.string(), -}); +export const Model2 = fc.record({ b: fc.string() }); -export const Model1 = fc.record({ - a: fc.integer(), -}); +export const Model1 = fc.record({ a: fc.integer() }); export const $Model = fc .tuple( Model1, Model2, fc.dictionary(fc.string(), fc.boolean()), - fc.record({ - c: fc.string(), - }), + fc.record({ c: fc.string() }), ) - .map(values => Object.assign(...values)); \ No newline at end of file + .map(values => Object.assign(...values)); diff --git a/test/snapshots/model-spread/samples.js b/test/snapshots/model-spread/samples.js index ffe349c..93a56e5 100644 --- a/test/snapshots/model-spread/samples.js +++ b/test/snapshots/model-spread/samples.js @@ -76,4 +76,4 @@ export const samples = { 'b': '' } ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/model/arbitraries.js b/test/snapshots/model/arbitraries.js index 0e66ca4..a29216e 100644 --- a/test/snapshots/model/arbitraries.js +++ b/test/snapshots/model/arbitraries.js @@ -3,4 +3,4 @@ import * as fc from 'fast-check'; export const $Model = fc.record({ a: fc.integer(), b: fc.string(), -}); \ No newline at end of file +}); diff --git a/test/snapshots/model/samples.js b/test/snapshots/model/samples.js index 78db661..956f4f9 100644 --- a/test/snapshots/model/samples.js +++ b/test/snapshots/model/samples.js @@ -21,4 +21,4 @@ export const samples = { 'b': 'J' } ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/namespace-in-file-namespace/arbitraries.js b/test/snapshots/namespace-in-file-namespace/arbitraries.js index adf9bef..b3de997 100644 --- a/test/snapshots/namespace-in-file-namespace/arbitraries.js +++ b/test/snapshots/namespace-in-file-namespace/arbitraries.js @@ -1,7 +1,5 @@ import * as fc from 'fast-check'; export const PetStore = { - Pets: { - - }, -}; \ No newline at end of file + Pets: {}, +}; diff --git a/test/snapshots/namespace-in-file-namespace/samples.js b/test/snapshots/namespace-in-file-namespace/samples.js index a4dd6d7..a7944b2 100644 --- a/test/snapshots/namespace-in-file-namespace/samples.js +++ b/test/snapshots/namespace-in-file-namespace/samples.js @@ -2,4 +2,4 @@ export const samples = { 'PetStore': { 'Pets': {} } -}; \ No newline at end of file +}; diff --git a/test/snapshots/namespace/arbitraries.js b/test/snapshots/namespace/arbitraries.js index 3a939b2..8b257aa 100644 --- a/test/snapshots/namespace/arbitraries.js +++ b/test/snapshots/namespace/arbitraries.js @@ -1,5 +1,3 @@ import * as fc from 'fast-check'; -export const PetStore = { - -}; \ No newline at end of file +export const PetStore = {}; diff --git a/test/snapshots/namespace/samples.js b/test/snapshots/namespace/samples.js index 8327c8a..6cae294 100644 --- a/test/snapshots/namespace/samples.js +++ b/test/snapshots/namespace/samples.js @@ -1,3 +1,3 @@ export const samples = { 'PetStore': {} -}; \ No newline at end of file +}; diff --git a/test/snapshots/never/arbitraries.js b/test/snapshots/never/arbitraries.js index 5624881..a6d8f1e 100644 --- a/test/snapshots/never/arbitraries.js +++ b/test/snapshots/never/arbitraries.js @@ -1,7 +1,5 @@ import * as fc from 'fast-check'; -export const $Model = fc.record({ - property: fc.constant(null).map(() => { - throw new Error('never'); - }), -}); \ No newline at end of file +export const $Model = fc.record({ property: fc.constant(null).map(() => { + throw new Error('never'); +}) }); diff --git a/test/snapshots/never/samples.js b/test/snapshots/never/samples.js index 5f8bc06..a9e6a4b 100644 --- a/test/snapshots/never/samples.js +++ b/test/snapshots/never/samples.js @@ -1,3 +1,3 @@ export const samples = { '$Model': '[Error: never]' -}; \ No newline at end of file +}; diff --git a/test/snapshots/null/arbitraries.js b/test/snapshots/null/arbitraries.js index 2920ba6..82b9d13 100644 --- a/test/snapshots/null/arbitraries.js +++ b/test/snapshots/null/arbitraries.js @@ -1,5 +1,3 @@ import * as fc from 'fast-check'; -export const $Model = fc.record({ - property: fc.constant(null), -}); \ No newline at end of file +export const $Model = fc.record({ property: fc.constant(null) }); diff --git a/test/snapshots/null/samples.js b/test/snapshots/null/samples.js index 8b6fa7c..84114a5 100644 --- a/test/snapshots/null/samples.js +++ b/test/snapshots/null/samples.js @@ -16,4 +16,4 @@ export const samples = { 'property': null } ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/numeric/arbitraries.js b/test/snapshots/numeric/arbitraries.js index ba3c465..c15cd64 100644 --- a/test/snapshots/numeric/arbitraries.js +++ b/test/snapshots/numeric/arbitraries.js @@ -2,15 +2,11 @@ import * as fc from 'fast-check'; export const Numeric = fc.double(); -export const MinValueNumeric = fc.double({ - min: -3.4e+39, -}); +export const MinValueNumeric = fc.double({ min: -3.4e+39 }); -export const MaxValueNumeric = fc.double({ - max: 3.4e+39, -}); +export const MaxValueNumeric = fc.double({ max: 3.4e+39 }); export const MinMaxValueNumeric = fc.double({ min: -3.4e+39, max: 3.4e+39, -}); \ No newline at end of file +}); diff --git a/test/snapshots/numeric/samples.js b/test/snapshots/numeric/samples.js index 9082698..8b3a900 100644 --- a/test/snapshots/numeric/samples.js +++ b/test/snapshots/numeric/samples.js @@ -27,4 +27,4 @@ export const samples = { 2.47e-322, -1.7976931348623115e+308 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/safeint/arbitraries.js b/test/snapshots/safeint/arbitraries.js index 7e6ac9f..2c9b78f 100644 --- a/test/snapshots/safeint/arbitraries.js +++ b/test/snapshots/safeint/arbitraries.js @@ -22,4 +22,4 @@ export const MinMaxValueSafeInt = fc.integer({ export const RedundantlyMinMaxValueSafeInt = fc.integer({ min: -2147483650, max: 2147483650, -}); \ No newline at end of file +}); diff --git a/test/snapshots/safeint/samples.js b/test/snapshots/safeint/samples.js index fc4ac08..f6a211a 100644 --- a/test/snapshots/safeint/samples.js +++ b/test/snapshots/safeint/samples.js @@ -41,4 +41,4 @@ export const samples = { -41, -9007199254740945 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/string/arbitraries.js b/test/snapshots/string/arbitraries.js index 85871d4..444daa7 100644 --- a/test/snapshots/string/arbitraries.js +++ b/test/snapshots/string/arbitraries.js @@ -2,15 +2,11 @@ import * as fc from 'fast-check'; export const String = fc.string(); -export const MinLengthString = fc.string({ - minLength: 1, -}); +export const MinLengthString = fc.string({ minLength: 1 }); -export const MaxLengthString = fc.string({ - maxLength: 5, -}); +export const MaxLengthString = fc.string({ maxLength: 5 }); export const MinAndMaxLengthString = fc.string({ minLength: 2, maxLength: 7, -}); \ No newline at end of file +}); diff --git a/test/snapshots/string/samples.js b/test/snapshots/string/samples.js index 71321c0..4ab4f3f 100644 --- a/test/snapshots/string/samples.js +++ b/test/snapshots/string/samples.js @@ -27,4 +27,4 @@ export const samples = { 'gp', '' ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/union/arbitraries.js b/test/snapshots/union/arbitraries.js index 8b4eef6..a80f516 100644 --- a/test/snapshots/union/arbitraries.js +++ b/test/snapshots/union/arbitraries.js @@ -4,4 +4,4 @@ export const Breed = fc.oneof( fc.string(), fc.integer(), fc.boolean(), -); \ No newline at end of file +); diff --git a/test/snapshots/union/samples.js b/test/snapshots/union/samples.js index 881b0b0..fdadac9 100644 --- a/test/snapshots/union/samples.js +++ b/test/snapshots/union/samples.js @@ -6,4 +6,4 @@ export const samples = { '', 542422934 ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/unknown/arbitraries.js b/test/snapshots/unknown/arbitraries.js index e08c480..36f2898 100644 --- a/test/snapshots/unknown/arbitraries.js +++ b/test/snapshots/unknown/arbitraries.js @@ -1,5 +1,3 @@ import * as fc from 'fast-check'; -export const $Model = fc.record({ - property: fc.anything(), -}); \ No newline at end of file +export const $Model = fc.record({ property: fc.anything() }); diff --git a/test/snapshots/unknown/samples.js b/test/snapshots/unknown/samples.js index ba52bc5..c1d4bcc 100644 --- a/test/snapshots/unknown/samples.js +++ b/test/snapshots/unknown/samples.js @@ -35,4 +35,4 @@ export const samples = { 'property': [] } ] -}; \ No newline at end of file +}; diff --git a/test/snapshots/void/arbitraries.js b/test/snapshots/void/arbitraries.js index 87c61b5..380d942 100644 --- a/test/snapshots/void/arbitraries.js +++ b/test/snapshots/void/arbitraries.js @@ -1,5 +1,3 @@ import * as fc from 'fast-check'; -export const $Model = fc.record({ - property: fc.constant(undefined), -}); \ No newline at end of file +export const $Model = fc.record({ property: fc.constant(undefined) }); diff --git a/test/snapshots/void/samples.js b/test/snapshots/void/samples.js index 68f6471..542778d 100644 --- a/test/snapshots/void/samples.js +++ b/test/snapshots/void/samples.js @@ -16,4 +16,4 @@ export const samples = { 'property': undefined } ] -}; \ No newline at end of file +};