installer_test.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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('models/cluster');
  20. require('controllers/wizard');
  21. require('controllers/installer');
  22. describe('App.InstallerController', function () {
  23. var installerController = App.InstallerController.create();
  24. describe('#loadStacksVersionsSuccessCallback', function() {
  25. var test_data = {
  26. "items" : [
  27. {
  28. "Versions" : {
  29. "active" : false,
  30. "min_upgrade_version" : null,
  31. "stack_name" : "HDP",
  32. "stack_version" : "1.2.0"
  33. }
  34. },
  35. {
  36. "Versions" : {
  37. "active" : true,
  38. "min_upgrade_version" : null,
  39. "stack_name" : "HDP",
  40. "stack_version" : "1.2.1"
  41. }
  42. },
  43. {
  44. "Versions" : {
  45. "active" : true,
  46. "min_upgrade_version" : "1.2.0",
  47. "stack_name" : "HDP",
  48. "stack_version" : "1.3.0"
  49. }
  50. },
  51. {
  52. "Versions" : {
  53. "active" : false,
  54. "min_upgrade_version" : null,
  55. "stack_name" : "HDP",
  56. "stack_version" : "2.0.1"
  57. }
  58. }
  59. ]
  60. }
  61. it ('Correct data', function() {
  62. installerController.loadStacksVersionsSuccessCallback(test_data);
  63. expect(installerController.get('stacks.length')).to.equal(2);
  64. expect(installerController.get('stacks').everyProperty('isSelected')).to.equal(false);
  65. expect(installerController.get('stacks').mapProperty('name')).to.eql(['HDP-1.3.0', 'HDP-1.2.1']);
  66. });
  67. });
  68. });