Yuki Takei 2 лет назад
Родитель
Сommit
d82919213c

+ 2 - 2
packages/remark-lsx/src/stores/lsx/parse-num-option.spec.ts

@@ -36,7 +36,7 @@ describe('addNumCondition()', () => {
     const caller = () => parseNumOption('-1:10');
 
     // then
-    expect(caller).toThrowError("The specified option 'num' is [-1:10] : the start must be larger or equal than 1");
+    expect(caller).toThrowError("The specified option 'num' is { start: -1, end: 10 } : the start must be larger or equal than 1");
     expect(parseRangeSpy).toHaveBeenCalledWith('-1:10');
   });
 
@@ -48,7 +48,7 @@ describe('addNumCondition()', () => {
     const caller = () => parseNumOption('3:2');
 
     // then
-    expect(caller).toThrowError("The specified option 'num' is [3:2] : the end must be larger or equal than the start");
+    expect(caller).toThrowError("The specified option 'num' is { start: 3, end: 2 } : the end must be larger or equal than the start");
     expect(parseRangeSpy).toHaveBeenCalledWith('3:2');
   });
 

+ 2 - 2
packages/remark-lsx/src/stores/lsx/parse-num-option.ts

@@ -22,11 +22,11 @@ export const parseNumOption = (optionsNum: string): ParseNumOptionResult | null
 
   // check start
   if (start < 1) {
-    throw new Error(`The specified option 'num' is [${start}:${end}] : the start must be larger or equal than 1`);
+    throw new Error(`The specified option 'num' is { start: ${start}, end: ${end} } : the start must be larger or equal than 1`);
   }
   // check end
   if (start > end && end > 0) {
-    throw new Error(`The specified option 'num' is [${start}:${end}] : the end must be larger or equal than the start`);
+    throw new Error(`The specified option 'num' is { start: ${start}, end: ${end} } : the end must be larger or equal than the start`);
   }
 
   const offset = start - 1;