step0_test.js 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. require('controllers/wizard/step1_controller');
  20. /*describe('App.InstallerStep1Controller', function () {
  21. describe('#validateStep1()', function () {
  22. it('should return false and sets invalidClusterName to true if cluster name is empty', function () {
  23. var controller = App.InstallerStep1Controller.create();
  24. controller.set('clusterName', '');
  25. expect(controller.validateStep1()).to.equal(false);
  26. expect(controller.get('invalidClusterName')).to.equal(true);
  27. })
  28. it('should return false and sets invalidClusterName to true if cluster name has whitespaces', function () {
  29. var controller = App.InstallerStep1Controller.create();
  30. controller.set('clusterName', 'My Cluster');
  31. expect(controller.validateStep1()).to.equal(false);
  32. expect(controller.get('invalidClusterName')).to.equal(true);
  33. })
  34. it('should return false and sets invalidClusterName to true if cluster name has special characters', function () {
  35. var controller = App.InstallerStep1Controller.create();
  36. controller.set('clusterName', 'my-cluster');
  37. expect(controller.validateStep1()).to.equal(false);
  38. expect(controller.get('invalidClusterName')).to.equal(true);
  39. })
  40. it('should return true, sets invalidClusterName to false if cluster name is valid', function () {
  41. var controller = App.InstallerStep1Controller.create();
  42. var clusterName = 'mycluster1';
  43. controller.set('clusterName', clusterName);
  44. expect(controller.validateStep1()).to.equal(true);
  45. expect(controller.get('invalidClusterName')).to.equal(false);
  46. })
  47. })
  48. })*/
  49. require('controllers/wizard/step0_controller');
  50. describe('App.WizardStep0Controller', function () {
  51. var wizardStep0Controller = App.WizardStep0Controller.create();
  52. describe('#invalidClusterName', function () {
  53. it('should return true if no cluster name is present', function () {
  54. wizardStep0Controller.set('hasSubmitted', true);
  55. wizardStep0Controller.set('content', {'cluster':{'name':''}});
  56. expect(wizardStep0Controller.get('invalidClusterName')).to.equal(true);
  57. })
  58. it('should return true if cluster name contains white spaces', function () {
  59. wizardStep0Controller.set('hasSubmitted', true);
  60. wizardStep0Controller.set('content', {'cluster':{'name':'the cluster'}});
  61. expect(wizardStep0Controller.get('invalidClusterName')).to.equal(true);
  62. })
  63. it('should return true if cluster name contains special chars', function () {
  64. wizardStep0Controller.set('hasSubmitted', true);
  65. wizardStep0Controller.set('content', {'cluster':{'name':'$cluster'}});
  66. expect(wizardStep0Controller.get('invalidClusterName')).to.equal(true);
  67. })
  68. })
  69. })