blob: e71999669a9cbbfdd2185bc8e0ea30b57e179f68 [file] [log] [blame]
xg353y4549fd92019-03-12 13:07:46 +01001
2describe('Property controller tests', function() {
3 var clModel = '{"name": "ClosedLoopTest","dcaeDeploymentId":"testId","dcaeDeploymentStatusUrl":"testUrl","lastComputedState":"DESIGN","svgRepresentation": "representation","globalPropertiesJson": [{"name":"deployParameters","value":{"location_id":"","service_id":"","policy_id":"AUTO_GENERATED_POLICY_ID_AT_SUBMIT"}}], "blueprint": "yaml","lastComputedState": "DESIGN","operationalPolicies": [ {"name": "OpPolicyTest", "configurationsJson": { "policy1": [{"name": "pname","value": "policy1"}]}}],"microServicePolicies": [{"name": "tca","properties": "", "shared": true,"policyTosca": "tosca","jsonRepresentation": {"schema":{"title":"DCAE TCA Config","type":"object","required":["name"],"properties":{"name":{"propertyOrder":101,"title":"Name","type":"string"}}}}}],"loopLogs": [{ } ] }';
4 cl_props = JSON.parse(clModel);
5 var propertyController = require('scripts/propertyController.js');
6
7 test('getOperationalPolicyProperty', () => {
8 var policyProp = '{"policy1": [{"name": "pname","value": "policy1"}]}';
9 expect(propertyController.getOperationalPolicyProperty()).toEqual(JSON.parse(policyProp));
10 });
11
12 test('getGlobalProperty', () => {
13 var globalProp = '[{"name":"deployParameters","value":{"location_id":"","service_id":"","policy_id":"AUTO_GENERATED_POLICY_ID_AT_SUBMIT"}}]';
14 expect(propertyController.getGlobalProperty()).toEqual(JSON.parse(globalProp));
15 });
16
17 test('getMsPropertyTca', () => {
18 expect(propertyController.getMsProperty("tca")).toEqual('');
19 });
20
21 test('getMsUITca', () => {
22 var msUI = '{"schema":{"title":"DCAE TCA Config","type":"object","required":["name"],"properties":{"name":{"propertyOrder":101,"title":"Name","type":"string"}}}}';
23 expect(propertyController.getMsUI("tca")).toEqual(JSON.parse(msUI));
24 });
25
26 test('getMsPropertyNotExist', () => {
27 expect(propertyController.getMsProperty("test")).toEqual(null);
28 });
29
30 test('getMsUINotExist', () => {
31 expect(propertyController.getMsUI("test")).toEqual(null);
32 });
xg353y4549fd92019-03-12 13:07:46 +010033});