-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaceholder-autocomplete.test.js
48 lines (40 loc) · 1.41 KB
/
placeholder-autocomplete.test.js
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
40
41
42
43
44
45
46
47
48
import {getFormattedStringFromInput} from "./placeholder-autocomplete";
describe('placeholder autocomplete', () => {
it('should format normal string correctly', () => {
const result = getFormattedStringFromInput({
currentText: 'fro',
terms: {
'from': ['georgy', 'artem']
}
});
expect(result).toEqual('from:georgy');
});
it('should format multiple values correctly', () => {
const result = getFormattedStringFromInput({
currentText: 'from:georgy,a',
terms: {
'from': ['georgy', 'artem', 'test']
}
});
expect(result).toEqual('from:georgy,artem');
});
it('should format long string correctly', () => {
const result = getFormattedStringFromInput({
currentText: 'from:georgy,art to:artem,test from:someone to:g',
terms: {
'from': ['georgy', 'artem', 'test'],
'to': ['georgy', 'artem', 'test']
}
});
expect(result).toEqual('from:georgy,art to:artem,test from:someone to:georgy');
})
it('should show string different than text', () => {
const result = getFormattedStringFromInput({
currentText: 'just a simple text',
terms: {
'from': ['georgy', 'artem', 'test']
}
});
expect(result).toEqual('just a simple text');
});
});