1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-04 21:30:05 +00:00

feat: parse log to array

This commit is contained in:
Saad Jutt
2022-02-20 04:50:09 +05:00
parent 034f3173bd
commit c5ad72c931
6 changed files with 68 additions and 6 deletions

View File

@@ -0,0 +1,33 @@
import { parseLogToArray } from '..'
describe('parseLogToArray', () => {
it('should parse log to array type', () => {
const log = parseLogToArray(`
line 1 of log content
line 2 of log content
line 3 of log content
line 4 of log content
`)
expect(log).toEqual([
{ line: '' },
{ line: 'line 1 of log content' },
{ line: 'line 2 of log content' },
{ line: 'line 3 of log content' },
{ line: 'line 4 of log content' },
{ line: ' ' }
])
})
it('should parse log to array type if empty', () => {
const log = parseLogToArray('')
expect(log).toEqual([])
})
it('should parse log to array type if not provided', () => {
const log = parseLogToArray()
expect(log).toEqual([])
})
})