-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathstring-utils.test.js
More file actions
39 lines (38 loc) · 1.35 KB
/
string-utils.test.js
File metadata and controls
39 lines (38 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/.
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
*
* Copyright (C) SugarCRM Inc. All rights reserved.
*/
const strUtils = require('../../../src/utils/string-utils.js');
describe('generateMessage', function() {
test.each([
{
template: 'Single ${} test',
filler: 'dog',
expected: 'Single dog test'
},
{
template: 'Multiples ${} ${} test',
filler: ['dog', 'cat'],
expected: 'Multiples dog cat test'
},
{
template: 'Mismatched ${} ${} ${} too few fillers',
filler: ['dog', 'cat'],
expected: 'Mismatched dog cat ${} too few fillers'
},
{
template: 'Mismatch ${} too many fillers',
filler: ['dog', 'cat'],
expected: 'Mismatch dog too many fillers'
}
])('should fill the template string as expected', (values) => {
let actual = strUtils.generateMessage(values.template, values.filler);
expect(actual).toEqual(values.expected);
});
});