summaryrefslogtreecommitdiffstats
path: root/__test__
diff options
context:
space:
mode:
authorEran (ev672n), Vosk <ev672n@att.com>2018-08-07 14:15:05 +0300
committerEran (ev672n), Vosk <ev672n@att.com>2018-08-07 14:15:05 +0300
commitb9708a7c3cfaf5767992a2b15180e7b85c459242 (patch)
tree076e19ea52232232e9060a9d7e074947a4a49508 /__test__
parentcc32bd38d72e5c1c92048657083952d3e45c1819 (diff)
adding the dcae dt code
Adding DCAE-dt code Change-Id: Id6b779db9d24e10825fb97ad5fd46f41e65e6738 Issue-ID: SDC-1614 Signed-off-by: Eran (ev672n), Vosk <ev672n@att.com>
Diffstat (limited to '__test__')
-rw-r--r--__test__/user-mapping.test.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/__test__/user-mapping.test.js b/__test__/user-mapping.test.js
new file mode 100644
index 0000000..8fdd613
--- /dev/null
+++ b/__test__/user-mapping.test.js
@@ -0,0 +1,41 @@
+var _ = require('underscore');
+
+var input = [];
+
+function monitoringTemplateProtocol(input) {
+ var nodeTypes = input;
+ if (nodeTypes.length < 2) {
+ if (nodeTypes[0] == 'FOI collector' || nodeTypes[0] == 'syslog') {
+ return nodeTypes[0];
+ } else {
+ return 'other';
+ }
+ } else {
+ var match = _.difference(nodeTypes, ["map", "enrich", "supplement"]);
+ return match.length > 0 ? 'other' : 'SNMP';
+ }
+}
+
+beforeEach(() => {
+ input = [];
+})
+
+test('should return FOI', () => {
+ input.push('FOI collector');
+ expect(monitoringTemplateProtocol(input)).toBe('FOI collector');
+})
+test('should return Syslog', () => {
+ input.push('syslog');
+ expect(monitoringTemplateProtocol(input)).toBe('syslog');
+})
+test('should return SNMP', () => {
+ input.push('map');
+ input.push('enrich');
+ input.push('supplement');
+ input = _.shuffle(input);
+ expect(monitoringTemplateProtocol(input)).toBe('SNMP');
+})
+test('should return other', () => {
+ input.push('west');
+ expect(monitoringTemplateProtocol(input)).toBe('other');
+})