Skip to content

Commit

Permalink
feat: duplicate tests to use with/without type inference
Browse files Browse the repository at this point in the history
  • Loading branch information
g4rcez committed Oct 10, 2022
1 parent e1def77 commit f33522f
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions types/FluentJSONSchema.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,36 +110,62 @@ const rawNullableSchema = S.object()

console.log('raw schema with nullable props\n', JSON.stringify(rawNullableSchema))

const dependentRequired = S.object()
.dependentRequired({
foo: ['bar'],
})
.prop('foo')
.prop('bar')
.valueOf()

console.log('dependentRequired:\n', JSON.stringify(dependentRequired))

const dependentSchemas = S.object()
.dependentSchemas({
foo: S.object().prop('bar'),
})
.prop('bar', S.object().prop('bar'))
.valueOf()

console.log('dependentRequired:\n', JSON.stringify(dependentSchemas))

const deprecatedSchema = S.object()
.deprecated()
.prop('foo', S.string().deprecated())
.valueOf()

console.log('deprecatedSchema:\n', JSON.stringify(deprecatedSchema))

type Foo = {
foo: string
bar: string
}

const dependentRequired = S.object<Foo>()
const dependentRequiredWithType = S.object<Foo>()
.dependentRequired({
foo: ['bar'],
})
.prop('foo')
.prop('bar')
.valueOf()

console.log('dependentRequired:\n', JSON.stringify(dependentRequired))
console.log('dependentRequired:\n', JSON.stringify(dependentRequiredWithType))

const dependentSchemas = S.object<Foo>()
const dependentSchemasWithType = S.object<Foo>()
.dependentSchemas({
foo: S.object().prop('bar'),
})
.prop('bar', S.object().prop('bar'))
.valueOf()

console.log('dependentRequired:\n', JSON.stringify(dependentSchemas))
console.log('dependentSchemasWithType:\n', JSON.stringify(dependentSchemasWithType))

const deprecatedSchema = S.object()
const deprecatedSchemaWithType = S.object<Foo>()
.deprecated()
.prop('foo', S.string().deprecated())
.valueOf()

console.log('deprecatedSchema:\n', JSON.stringify(deprecatedSchema))
console.log('deprecatedSchemaWithType:\n', JSON.stringify(deprecatedSchemaWithType))

type ReallyLongType = {
foo: string
Expand Down

0 comments on commit f33522f

Please sign in to comment.