2 describe('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');
7 test('getOperationalPolicyProperty', () => {
8 var policyProp = '{"policy1": [{"name": "pname","value": "policy1"}]}';
9 expect(propertyController.getOperationalPolicyProperty()).toEqual(JSON.parse(policyProp));
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));
17 test('getMsPropertyTca', () => {
18 expect(propertyController.getMsProperty("tca")).toEqual('');
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));
26 test('getMsPropertyNotExist', () => {
27 expect(propertyController.getMsProperty("test")).toEqual(null);
30 test('getMsUINotExist', () => {
31 expect(propertyController.getMsUI("test")).toEqual(null);
34 test('getStatus', () => {
35 expect(propertyController.getStatus()).toEqual('DESIGN');
38 test('getDeploymentID', () => {
39 expect(propertyController.getDeploymentID()).toEqual('testId');
42 test('getDeploymentStatusURL', () => {
43 expect(propertyController.getDeploymentStatusURL()).toEqual('testUrl');