@@ -36,62 +36,11 @@ test('can print a type', () => {
3636 . options ( { format : 'cbor' } ) ,
3737 ) ,
3838 t . prop ( 'map' , t . Map ( t . num ) ) ,
39+ t . prop ( 'simpleFn1' , t . fn ) ,
40+ t . prop ( 'simpleFn2' , t . fn$ ) ,
41+ t . prop ( 'function' , t . Function ( t . Object ( t . prop ( 'id' , t . str ) ) , t . Object ( t . prop ( 'name' , t . str ) ) ) ) ,
3942 )
4043 . options ( { unknownFields : true } ) ;
4144 // console.log(type + '');
42- expect ( type + '' ) . toMatchInlineSnapshot ( `
43- "obj { unknownFields = !t }
44- ├─ "id": { description = "The id of the object" }
45- │ └─ str { validator = [ "id", "uuid" ] }
46- ├─ "tags": { title = "Always use tags" }
47- │ └─ arr { title = "Tags" }
48- │ └─ str
49- ├─ "optional"?:
50- │ └─ any
51- ├─ "booleanProperty":
52- │ └─ bool
53- ├─ "numberProperty":
54- │ └─ num { format = "f64", gt = 3.14 }
55- ├─ "binaryProperty":
56- │ └─ bin { format = "cbor" }
57- │ └─ any
58- ├─ "arrayProperty":
59- │ └─ arr
60- │ └─ any
61- ├─ "objectProperty":
62- │ └─ obj
63- │ └─ "id":
64- │ └─ str { ascii = !t, min = 3, max = 128 }
65- ├─ "unionProperty":
66- │ └─ or { discriminator = [ "?", [ "==", !n, [ "$", "" ] ], 2, [ "?", [ "==", [ "type", [ "$", "" ] ], "number" ], 1, 0 ] ] }
67- │ ├─ str
68- │ ├─ num
69- │ └─ const { description = "" } → null
70- ├─ "enumAsConst"?:
71- │ └─ or { discriminator = [ "?", [ "==", "c", [ "$", "" ] ], 2, [ "?", [ "==", "b", [ "$", "" ] ], 1, 0 ] ] }
72- │ ├─ const → "a"
73- │ ├─ const → "b"
74- │ └─ const → "c"
75- ├─ "refField"?:
76- │ └─ ref → [refId]
77- ├─ "und"?:
78- │ └─ const → undefined
79- ├─ "operation":
80- │ └─ obj
81- │ ├─ "type":
82- │ │ └─ const { title = "Always use replace" } → "replace"
83- │ ├─ "path":
84- │ │ └─ str
85- │ └─ "value":
86- │ └─ any
87- ├─ "binaryOperation":
88- │ └─ bin { format = "cbor" }
89- │ └─ tup { description = "Should always have 3 elements" }
90- │ ├─ const { description = "7 is the magic number" } → 7
91- │ ├─ str
92- │ └─ any
93- └─ "map":
94- └─ map
95- └─ num"
96- ` ) ;
45+ expect ( type + '' ) . toMatchSnapshot ( ) ;
9746} ) ;
0 commit comments