import { describe, expect, it } 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) }) })