Skip to content

Commit 560a09f

Browse files
author
Shruti
committed
Moved test cases out of map serialization block
1 parent ae703d7 commit 560a09f

1 file changed

Lines changed: 10 additions & 30 deletions

File tree

tests/doc/stringify.ts

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,16 @@ blah blah\n`)
186186
.map(line => line.length)
187187
).toMatchObject([4, 20, 20, 20, 20, 10, 0])
188188
})
189+
190+
test('Keep pipe when empty block literal is given', () => {
191+
const doc = YAML.parseDocument('|-')
192+
expect(String(doc)).toBe('|\n\n')
193+
})
194+
195+
test('Keep pipe when pipe is provided', () => {
196+
const doc = YAML.parseDocument('|')
197+
expect(String(doc)).toBe('|\n\n')
198+
})
189199
})
190200
})
191201
}
@@ -330,36 +340,6 @@ z:
330340
expect(String(doc)).toBe('? >+ #comment\n foo\n\n: bar\n')
331341
})
332342

333-
test('Keep pipe when empty block literal is given', () => {
334-
const doc = YAML.parseDocument('|-')
335-
expect(String(doc)).toBe('|\n\n')
336-
})
337-
338-
test('Keep pipe when pipe is provided', () => {
339-
const doc = YAML.parseDocument('|')
340-
expect(String(doc)).toBe('|\n\n')
341-
})
342-
343-
test('Keep pipe when empty block literal is given yaml format', () => {
344-
const src = source`
345-
log4j_2: |-
346-
`;
347-
const expected = source`
348-
log4j_2: |
349-
350-
`;
351-
const doc = YAML.parseDocument(src)
352-
expect(String(doc)).toBe(expected)
353-
})
354-
355-
test('Keep pipe when pipe is provided in yaml format', () => {
356-
const src = source`
357-
log4j_2: |
358-
`
359-
const doc = YAML.parseDocument(src)
360-
expect(String(doc)).toBe(src+'\n')
361-
})
362-
363343
test('Document as key', () => {
364344
const doc = new YAML.Document({ a: 1 })
365345
doc.add(new YAML.Document({ b: 2, c: 3 }))

0 commit comments

Comments
 (0)