1 | import { IfStringHelper } from './if-string.helper';
|
2 | import { expect } from 'chai';
|
3 |
|
4 | describe(IfStringHelper.name, () => {
|
5 | let helper: IfStringHelper;
|
6 | let options = {
|
7 | fn: () => 'fnCalled',
|
8 | inverse: () => 'inverseCalled'
|
9 | };
|
10 |
|
11 | beforeEach(() => {
|
12 | helper = new IfStringHelper();
|
13 | });
|
14 |
|
15 | describe('when input is string', () => {
|
16 | it('should call and return value of options.fn', () => {
|
17 | const result = helper.helperFunc(undefined, 'someString', options);
|
18 | expect(result).to.equal('fnCalled');
|
19 | });
|
20 | });
|
21 |
|
22 | describe('when input is not a string', () => {
|
23 | it('should call and return value of options.reverse', () => {
|
24 | const result = helper.helperFunc(undefined, 123, options);
|
25 | expect(result).to.equal('inverseCalled');
|
26 | });
|
27 | });
|
28 | });
|