File size: 725 Bytes
d9494a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { isValidVariable } from '@/utils/validation/isValidVariable';

describe('isValidVariable', () => {
  it('should return true for valid variable syntax', () => {
    expect(isValidVariable('{{step.output}}')).toBe(true);
  });

  it('should return true for nested variable', () => {
    expect(isValidVariable('{{trigger.output.name}}')).toBe(true);
  });

  it('should return false for string without brackets', () => {
    expect(isValidVariable('no brackets')).toBe(false);
  });

  it('should return false for partial brackets', () => {
    expect(isValidVariable('{{incomplete')).toBe(false);
  });

  it('should return false for empty brackets', () => {
    expect(isValidVariable('{{}}')).toBe(false);
  });
});