summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx6
-rw-r--r--test/utils/Crypto.test.js28
2 files changed, 32 insertions, 2 deletions
diff --git a/src/generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx b/src/generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx
index 4f93125..47cdc9a 100644
--- a/src/generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx
+++ b/src/generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx
@@ -164,7 +164,8 @@ export default class AutoCompleteSearchBar extends Component {
<Highlighter key={arrayIndex + 'high'}
highlightClassName='highlight'
searchWords={toHighLightArray}
- textToHighlight={suggestionTextArray[arrayIndex]}/>
+ textToHighlight={suggestionTextArray[arrayIndex]}
+ autoEscape={true}/>
{ ++arrayIndex ? ' ' : ' '}
</span>);
@@ -185,7 +186,8 @@ export default class AutoCompleteSearchBar extends Component {
<Highlighter key={arrayIndex + 'high'}
highlightClassName='highlight'
searchWords={toHighLightArray}
- textToHighlight={suggestionTextArray[arrayIndex]}/>
+ textToHighlight={suggestionTextArray[arrayIndex]}
+ autoEscape={true}/>
{ ++arrayIndex ? ' ' : ' '}
</span>);
diff --git a/test/utils/Crypto.test.js b/test/utils/Crypto.test.js
new file mode 100644
index 0000000..e1f7566
--- /dev/null
+++ b/test/utils/Crypto.test.js
@@ -0,0 +1,28 @@
+import {decrypt, encrypt, encode, decode} from 'utils/Crypto.js';
+
+describe('Crypto', () => {
+ it('encrypt and decrypt text properly', () => {
+ // given
+ const stringToEncrypt = 'textToEncrypt';
+
+ // when
+ const encryptedString = encrypt(stringToEncrypt);
+
+ // then
+ const decryptedString = decrypt(encryptedString);
+ expect(decryptedString).toBe(stringToEncrypt);
+ });
+
+ it('encode and decode text properly', () => {
+ // given
+ const stringToEncrypt = 'textToEncode';
+
+ // when
+ const encryptedString = encode(stringToEncrypt);
+
+ // then
+ const decryptedString = decode(encryptedString);
+ expect(decryptedString).toBe(stringToEncrypt);
+ });
+
+});