upgrade_entity_test.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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/upgrade_entity');
  20. describe('App.upgradeEntity', function () {
  21. var model = App.upgradeEntity.create();
  22. describe("#isRunning", function() {
  23. it("status IN_PROGRESS", function() {
  24. model.set('status', 'IN_PROGRESS');
  25. model.propertyDidChange('isRunning');
  26. expect(model.get('isRunning')).to.be.true;
  27. });
  28. it("status PENDING", function() {
  29. model.set('status', 'PENDING');
  30. model.propertyDidChange('isRunning');
  31. expect(model.get('isRunning')).to.be.false;
  32. });
  33. });
  34. describe("#progress", function() {
  35. it("progress_percent = 1.9", function() {
  36. model.set('progress_percent', 1.9);
  37. model.propertyDidChange('progress');
  38. expect(model.get('progress')).to.equal(1);
  39. });
  40. it("progress_percent = 1", function() {
  41. model.set('progress_percent', 1);
  42. model.propertyDidChange('progress');
  43. expect(model.get('progress')).to.equal(1);
  44. });
  45. });
  46. describe("#isActive", function() {
  47. it("status IN_PROGRESS", function() {
  48. model.set('status', 'IN_PROGRESS');
  49. model.propertyDidChange('isActive');
  50. expect(model.get('isActive')).to.be.true;
  51. });
  52. it("status PENDING", function() {
  53. model.set('status', 'PENDING');
  54. model.propertyDidChange('isActive');
  55. expect(model.get('isActive')).to.be.false;
  56. });
  57. });
  58. });