Issues (72)

tests/utils.string.test.js (9 issues)

Labels
Severity
1
const {
2
    utils: { string },
3
} = require('../dist/jaxon.module');
4
5
test('Replace single quotes with double quotes.', () => {
6
    expect(string.doubleQuotes("'Quoted'")).toBe('"Quoted"');
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
7
});
8
9
test('Replace double quotes with single quotes.', () => {
10
    expect(string.singleQuotes('"Quoted"')).toBe("'Quoted'");
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
11
});
12
13
test('Strip on prefix.', () => {
14
    expect(string.stripOnPrefix('onclick')).toBe('click');
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
15
});
16
17
test('Strip on prefix with capital letter.', () => {
18
    expect(string.stripOnPrefix('onClick')).toBe('click');
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
19
});
20
21
test('Strip on prefix with no prefix.', () => {
22
    expect(string.stripOnPrefix('click')).toBe('click');
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
23
});
24
25
test('Add on prefix.', () => {
26
    expect(string.addOnPrefix('click')).toBe('onclick');
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
27
});
28
29
test('Add on prefix with prefix.', () => {
30
    expect(string.addOnPrefix('onclick')).toBe('onclick');
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
31
});
32
33
test('Add on prefix with capital letter.', () => {
34
    expect(string.addOnPrefix('Click')).toBe('onclick');
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
35
});
36
37
test('Add on prefix with capital letter and prefix.', () => {
38
    expect(string.addOnPrefix('onClick')).toBe('onclick');
0 ignored issues
show
The variable string seems to be never declared. If this is a global, consider adding a /** global: string */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
39
});
40
41
test('Replace placeholder in a string.', () => {
42
    expect('Really Mr. {name}?'.supplant({'name': 'Johnson'})).toBe('Really Mr. Johnson?');
43
});
44
45
test('Replace placeholders in a string.', () => {
46
    expect('{name} Mr. {word}!'.supplant({'name': 'Goodbye', 'word': 'Johnson'})).toBe('Goodbye Mr. Johnson!');
47
});
48
49
test('Replace inversed placeholders in a string.', () => {
50
    expect('Mr. {word}, {name}!'.supplant({'name': 'Goodbye', 'word': 'Johnson'})).toBe('Mr. Johnson, Goodbye!');
51
});
52