diff --git a/apps/server/src/services/integration-service/integrationUtils.test.ts b/apps/server/src/services/integration-service/integrationUtils.test.ts index e091c0943..3203a5349 100644 --- a/apps/server/src/services/integration-service/integrationUtils.test.ts +++ b/apps/server/src/services/integration-service/integrationUtils.test.ts @@ -116,6 +116,18 @@ describe('parseNestedTemplate() -> stringToOSCArgs()', () => { test: '"string with space and {{not.so.easy}}"', expect: [{ type: 'string', value: 'string with space and data with space' }], }, + { + test: '', + expect: [], + }, + { + test: ' ', + expect: [], + }, + { + test: '""', + expect: [{ type: 'string', value: '' }], + }, { test: '"string with space and {{not.so.empty}}"', expect: [{ type: 'string', value: 'string with space and ' }], diff --git a/apps/server/src/utils/__tests__/oscArgParser.test.ts b/apps/server/src/utils/__tests__/oscArgParser.test.ts index 6b97e0707..06fceee41 100644 --- a/apps/server/src/utils/__tests__/oscArgParser.test.ts +++ b/apps/server/src/utils/__tests__/oscArgParser.test.ts @@ -25,6 +25,12 @@ describe('test stringToOSCArgs()', () => { expect(stringToOSCArgs(test)).toStrictEqual(expected); }); + it('1 space is nothing', () => { + const test = ' '; + const expected = []; + expect(stringToOSCArgs(test)).toStrictEqual(expected); + }); + it('keep other types in strings', () => { const test = 'test "1111" "0.1111" "TRUE" "FALSE"'; const expected = [ diff --git a/apps/server/src/utils/oscArgParser.ts b/apps/server/src/utils/oscArgParser.ts index 01bdf970a..0283a129c 100644 --- a/apps/server/src/utils/oscArgParser.ts +++ b/apps/server/src/utils/oscArgParser.ts @@ -7,6 +7,10 @@ export function stringToOSCArgs(argsString: string | undefined): Argument[] { } const matches = splitWhitespace(argsString); + if (!matches) { + return new Array(); + } + const parsedArguments: Argument[] = matches.map((argString: string) => { const argAsNum = Number(argString); // NOTE: number like: 1 2.0 33333