diff --git a/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/variable-resolver.util.spec.ts b/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/variable-resolver.util.spec.ts index dc41cb81d..4d5634a3c 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/variable-resolver.util.spec.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-executor/utils/__tests__/variable-resolver.util.spec.ts @@ -74,4 +74,40 @@ describe('resolveInput', () => { expect(resolveInput(input, context)).toEqual(expected); }); + + it('does not wrap string variables with double quotes', () => { + expect( + resolveInput('{ {{test}}: 2 }', { + test: 'prop', + }), + ).toBe('{ prop: 2 }'); + }); + + it('does not modify static JSON', () => { + expect(resolveInput('{ "a": 2 }', {})).toBe('{ "a": 2 }'); + }); + + it('supports variable as JSON object property name', () => { + expect( + resolveInput('{ "{{test}}": 2 }', { + test: 'prop', + }), + ).toBe('{ "prop": 2 }'); + }); + + it('supports variable as JSON number value', () => { + expect( + resolveInput('{ "a": {{test}} }', { + test: 2, + }), + ).toBe('{ "a": 2 }'); + }); + + it('supports variable as JSON string value', () => { + expect( + resolveInput('{ "a": "{{test}}" }', { + test: 'str', + }), + ).toBe('{ "a": "str" }'); + }); });