zahmis пре 5 година
родитељ
комит
d9ee2699d4
1 измењених фајлова са 28 додато и 1 уклоњено
  1. 28 1
      packages/slack/src/utils/slash-command-parser.test.ts

+ 28 - 1
packages/slack/src/utils/slash-command-parser.test.ts

@@ -29,7 +29,6 @@ describe('parse SlashCommand', () => {
 
     // when
     const result = parse(slashCommand);
-    console.log('32', result);
 
     // then
     expect(result.text).toBe(slashCommandText);
@@ -37,6 +36,34 @@ describe('parse SlashCommand', () => {
     expect(result.growiCommandArgs).toStrictEqual([]);
   });
 
+  test('returns a GrowiCommand instance with space growiCommandType', () => {
+    // setup
+    const slashCommandText = 'search         ';
+    const slashCommand = new SlashCommandMock(slashCommandText);
+
+    // when
+    const result = parse(slashCommand);
+
+    // then
+    expect(result.text).toBe(slashCommandText);
+    expect(result.growiCommandType).toBe('search');
+    expect(result.growiCommandArgs).toStrictEqual([]);
+  });
+
+  test('returns a GrowiCommand instance with space growiCommandArgs', () => {
+    // setup
+    const slashCommandText = 'search hoge       ';
+    const slashCommand = new SlashCommandMock(slashCommandText);
+
+    // when
+    const result = parse(slashCommand);
+
+    // then
+    expect(result.text).toBe(slashCommandText);
+    expect(result.growiCommandType).toBe('search');
+    expect(result.growiCommandArgs).toStrictEqual(['hoge']);
+  });
+
   test('returns a GrowiCommand instance', () => {
     // setup
     const slashCommandText = 'search keyword1 keyword2';