@@ -71,7 +71,7 @@ describe('tags', () => {
71
71
72
72
test ( 'eemeli/yaml#97' , ( ) => {
73
73
const doc = YAML . parseDocument ( 'foo: !!float 3.0' )
74
- expect ( String ( doc ) ) . toBe ( 'foo: !!float 3\n' )
74
+ expect ( String ( doc ) ) . toBe ( 'foo: !!float 3.0 \n' )
75
75
} )
76
76
} )
77
77
@@ -84,6 +84,7 @@ describe('number types', () => {
84
84
- 123_456
85
85
- 3.1e+2
86
86
- 5.1_2_3E-1
87
+ - 4.02
87
88
- 4.20`
88
89
const doc = YAML . parseDocument ( src , { version : '1.1' } )
89
90
expect ( doc . contents . items ) . toMatchObject ( [
@@ -93,10 +94,13 @@ describe('number types', () => {
93
94
{ value : 123456 } ,
94
95
{ value : 310 , format : 'EXP' } ,
95
96
{ value : 0.5123 , format : 'EXP' } ,
96
- { value : 4.2 }
97
+ { value : 4.02 } ,
98
+ { value : 4.2 , minFractionDigits : 2 }
97
99
] )
98
100
expect ( doc . contents . items [ 3 ] ) . not . toHaveProperty ( 'format' )
99
101
expect ( doc . contents . items [ 6 ] ) . not . toHaveProperty ( 'format' )
102
+ expect ( doc . contents . items [ 6 ] ) . not . toHaveProperty ( 'minFractionDigits' )
103
+ expect ( doc . contents . items [ 7 ] ) . not . toHaveProperty ( 'format' )
100
104
} )
101
105
102
106
test ( 'Version 1.2' , ( ) => {
@@ -106,6 +110,7 @@ describe('number types', () => {
106
110
- 123456
107
111
- 3.1e+2
108
112
- 5.123E-1
113
+ - 4.02
109
114
- 4.20`
110
115
const doc = YAML . parseDocument ( src , { version : '1.2' } )
111
116
expect ( doc . contents . items ) . toMatchObject ( [
@@ -114,10 +119,13 @@ describe('number types', () => {
114
119
{ value : 123456 } ,
115
120
{ value : 310 , format : 'EXP' } ,
116
121
{ value : 0.5123 , format : 'EXP' } ,
117
- { value : 4.2 }
122
+ { value : 4.02 } ,
123
+ { value : 4.2 , minFractionDigits : 2 }
118
124
] )
119
125
expect ( doc . contents . items [ 2 ] ) . not . toHaveProperty ( 'format' )
120
126
expect ( doc . contents . items [ 5 ] ) . not . toHaveProperty ( 'format' )
127
+ expect ( doc . contents . items [ 5 ] ) . not . toHaveProperty ( 'minFractionDigits' )
128
+ expect ( doc . contents . items [ 6 ] ) . not . toHaveProperty ( 'format' )
121
129
} )
122
130
} )
123
131
0 commit comments