Skip to content

Commit 697551b

Browse files
committed
Add unit tests for containsSpaces handlebars extension.
1 parent 8d26ae5 commit 697551b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/utils/registerHandlebarHelpers.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,20 @@ describe('registerHandlebarHelpers', () => {
1010
expect(helpers).toContain('notEquals');
1111
expect(helpers).toContain('containsSpaces');
1212
});
13+
14+
describe('containsSpaces', () => {
15+
it('should return true when string with spaces is passed', () => {
16+
registerHandlebarHelpers();
17+
const containsSpaces = Handlebars.helpers['containsSpaces'];
18+
const result = containsSpaces('I have spaces insideme');
19+
expect(result).toBeTruthy();
20+
});
21+
22+
it('should return false when string without spaces is passed', () => {
23+
registerHandlebarHelpers();
24+
const containsSpaces = Handlebars.helpers['containsSpaces'];
25+
const result = containsSpaces('Ihavespacesinsideme');
26+
expect(result).toBeFalsy();
27+
});
28+
});
1329
});

0 commit comments

Comments
 (0)