fet: Add changes lol
Signed-off-by: Florian BOUILLON <f.bouillon@aptatio.com>
This commit is contained in:
50
tests/libs/gcodeUtilts.test.ts
Normal file
50
tests/libs/gcodeUtilts.test.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import { afterEach, assert, beforeEach, describe, expect, it, test, vi } from 'vitest'
|
||||
import { getParams } from '../../src/libs/gcodeUtils'
|
||||
|
||||
|
||||
describe('gcodeUtils', () => {
|
||||
it('should get parameters', () => {
|
||||
const gcode = `
|
||||
balfs
|
||||
dgfdf
|
||||
sd
|
||||
httphq
|
||||
estimated_printing_time_normal_modewef
|
||||
|
||||
; test=a
|
||||
fgd
|
||||
;test =b
|
||||
;test= c
|
||||
;test = d
|
||||
;number=1.12
|
||||
;number2=-1
|
||||
;invalid=
|
||||
;invalid
|
||||
;estimated_printing_time_normal_mode=1d 1h 1m 1s
|
||||
|
||||
sdffgaf
|
||||
fgsdf
|
||||
g
|
||||
sfd
|
||||
hh
|
||||
ehf
|
||||
`
|
||||
expect(getParams(gcode)).toEqual({
|
||||
test: 'a',
|
||||
test_1: 'b',
|
||||
test_2: 'c',
|
||||
test_3: 'd',
|
||||
number: 1.12,
|
||||
number2: -1,
|
||||
estimated_printing_time_normal_mode: '1d 1h 1m 1s',
|
||||
estimated_printing_time_seconds: 90061
|
||||
})
|
||||
})
|
||||
|
||||
it('should get parameters', () => {
|
||||
const gcode = `
|
||||
;estimated_printing_time_normal_mode=1w 1d 1h 1m 1s
|
||||
`
|
||||
expect(() => getParams(gcode)).toThrow(/1w/g)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user