Merge "Add tests to notifications module"
authorJames Forsyth <jf2512@att.com>
Tue, 25 Sep 2018 12:46:32 +0000 (12:46 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 25 Sep 2018 12:46:32 +0000 (12:46 +0000)
src/generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.jsx
test/utils/Crypto.test.js [new file with mode: 0644]

index 4f93125..47cdc9a 100644 (file)
@@ -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 (file)
index 0000000..e1f7566
--- /dev/null
@@ -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);
+    });
+
+});