aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/javascript
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2019-03-12 13:07:46 +0100
committerxg353y <xg353y@intl.att.com>2019-03-13 11:59:04 +0100
commit4549fd92024cdadf3277d7cc364f33109ca22b59 (patch)
tree68a65abd2b9f6bba6235c8cee3515660539cedaa /src/test/javascript
parent6adb590f29c9f2ccd3270fc10334c1c0859d92e7 (diff)
Add UI tests
Add test cases for propertyController.js Issue-ID: CLAMP-310 Change-Id: I7ae2cc425d9a7343791bae9ab7704e09389f270a Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/test/javascript')
-rw-r--r--src/test/javascript/propertyController.test.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/test/javascript/propertyController.test.js b/src/test/javascript/propertyController.test.js
new file mode 100644
index 000000000..6cb779145
--- /dev/null
+++ b/src/test/javascript/propertyController.test.js
@@ -0,0 +1,45 @@
+
+describe('Property controller tests', function() {
+ 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": [{ } ] }';
+ cl_props = JSON.parse(clModel);
+ var propertyController = require('scripts/propertyController.js');
+
+ test('getOperationalPolicyProperty', () => {
+ var policyProp = '{"policy1": [{"name": "pname","value": "policy1"}]}';
+ expect(propertyController.getOperationalPolicyProperty()).toEqual(JSON.parse(policyProp));
+ });
+
+ test('getGlobalProperty', () => {
+ var globalProp = '[{"name":"deployParameters","value":{"location_id":"","service_id":"","policy_id":"AUTO_GENERATED_POLICY_ID_AT_SUBMIT"}}]';
+ expect(propertyController.getGlobalProperty()).toEqual(JSON.parse(globalProp));
+ });
+
+ test('getMsPropertyTca', () => {
+ expect(propertyController.getMsProperty("tca")).toEqual('');
+ });
+
+ test('getMsUITca', () => {
+ var msUI = '{"schema":{"title":"DCAE TCA Config","type":"object","required":["name"],"properties":{"name":{"propertyOrder":101,"title":"Name","type":"string"}}}}';
+ expect(propertyController.getMsUI("tca")).toEqual(JSON.parse(msUI));
+ });
+
+ test('getMsPropertyNotExist', () => {
+ expect(propertyController.getMsProperty("test")).toEqual(null);
+ });
+
+ test('getMsUINotExist', () => {
+ expect(propertyController.getMsUI("test")).toEqual(null);
+ });
+
+ test('getStatus', () => {
+ expect(propertyController.getStatus()).toEqual('DESIGN');
+ });
+
+ test('getDeploymentID', () => {
+ expect(propertyController.getDeploymentID()).toEqual('testId');
+ });
+
+ test('getDeploymentStatusURL', () => {
+ expect(propertyController.getDeploymentStatusURL()).toEqual('testUrl');
+ });
+}); \ No newline at end of file