step9_view_test.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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('views/wizard/step9_view');
  20. describe('App.HostStatusView', function () {
  21. var tests = [
  22. {
  23. p: 'isFailed',
  24. tests: [
  25. {
  26. obj: {
  27. status: 'failed',
  28. progress: 100
  29. },
  30. e: true
  31. },
  32. {
  33. obj: {
  34. status: 'failed',
  35. progress: 99
  36. },
  37. e: false
  38. },
  39. {
  40. obj: {
  41. status: 'success',
  42. progress: 100
  43. },
  44. e: false
  45. },
  46. {
  47. obj: {
  48. status: 'success',
  49. progress: 99
  50. },
  51. e: false
  52. }
  53. ]
  54. },
  55. {
  56. p: 'isSuccess',
  57. tests: [
  58. {
  59. obj: {
  60. status: 'success',
  61. progress: 100
  62. },
  63. e: true
  64. },
  65. {
  66. obj: {
  67. status: 'success',
  68. progress: 99
  69. },
  70. e: false
  71. },
  72. {
  73. obj: {
  74. status: 'failed',
  75. progress: 100
  76. },
  77. e: false
  78. },
  79. {
  80. obj: {
  81. status: 'failed',
  82. progress: 99
  83. },
  84. e: false
  85. }
  86. ]
  87. },
  88. {
  89. p: 'isWarning',
  90. tests: [
  91. {
  92. obj: {
  93. status: 'warning',
  94. progress: 100
  95. },
  96. e: true
  97. },
  98. {
  99. obj: {
  100. status: 'warning',
  101. progress: 99
  102. },
  103. e: false
  104. },
  105. {
  106. obj: {
  107. status: 'failed',
  108. progress: 100
  109. },
  110. e: false
  111. },
  112. {
  113. obj: {
  114. status: 'failed',
  115. progress: 99
  116. },
  117. e: false
  118. }
  119. ]
  120. }
  121. ];
  122. tests.forEach(function(test) {
  123. describe(test.p, function() {
  124. test.tests.forEach(function(t) {
  125. var hostStatusView = App.HostStatusView.create();
  126. it('obj.progress = ' + t.obj.progress + '; obj.status = ' + t.obj.status, function() {
  127. hostStatusView.set('obj', t.obj);
  128. expect(hostStatusView.get(test.p)).to.equal(t.e);
  129. });
  130. });
  131. });
  132. });
  133. });