Skip to content

Commit ece4d2e

Browse files
.
1 parent d27ca1c commit ece4d2e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tests/term-text-search.test.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* - Caret : Cursor position in text (numeric)
55
* - Term : User input, any string value, can be empty
66
* - Token : Matched part of term (part left, part right)
7-
* - Word : Result (combined tokens, if any)
7+
* - Text : Result (combined tokens, if any)
88
*
99
* ###
1010
*
@@ -13,6 +13,7 @@
1313
*
1414
* Required
1515
* - Input data expectations + assumptions:
16+
* - Text can be anything (including special characters, numbers, ...)
1617
* - All values are strings
1718
* - Term can be empty
1819
* - Multi-byte support (= No RegEx for a-z possible)
@@ -39,7 +40,7 @@
3940
*
4041
* Pseudo-type annotations similar to TypeScript/Flow:
4142
* - constructor()
42-
* - getWordAtCaretPosition(string text, uint caretPosition): string
43+
* - getTextAtCaretPosition(string text, uint caretPosition): string
4344
*
4445
* ###
4546
*
@@ -52,20 +53,21 @@
5253
* - No result : '' : * | Empty
5354
* - No result : ' ' : * | Whitespace
5455
* - No result : ' A ' : Before | Whitespace
55-
* - No result : ' A ' : After | Whitespace
56+
* - No result : ' 1 ' : After | Whitespace – Numeric
5657
* - Result : 'A' : Before | Match (right)
57-
* - Result : 'A' : After | Match (left)
58+
* - Result : '1' : After | Match (left) – Numeric
5859
* - Result : 'AA' : Inner | Match (left + right)
60+
* - Result : '#' : Before | Match (right) – Special character
5961
* - ---------- : ---- : --------------------------------------
6062
*/
6163
const TermTextSearch = require('./term-text-search');
6264

6365
const instance = new TermTextSearch();
6466

65-
describe('xxx', () => {
67+
describe('Term text search', () => {
6668

67-
test('', () => {
68-
//const result = instance.search('');
69+
test('no result for empty text', () => {
70+
//const result = instance.getTextAtCaretPosition('');
6971
//expect(result).toStrictEqual([]);
7072
});
7173

0 commit comments

Comments
 (0)