From b9708a7c3cfaf5767992a2b15180e7b85c459242 Mon Sep 17 00:00:00 2001 From: "Eran (ev672n), Vosk" Date: Tue, 7 Aug 2018 14:15:05 +0300 Subject: adding the dcae dt code Adding DCAE-dt code Change-Id: Id6b779db9d24e10825fb97ad5fd46f41e65e6738 Issue-ID: SDC-1614 Signed-off-by: Eran (ev672n), Vosk --- __test__/user-mapping.test.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 __test__/user-mapping.test.js (limited to '__test__') 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'); +}) -- cgit