github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/tests/unit/components/gauge-chart-test.js (about) 1 import { module, test } from 'qunit'; 2 import { setupTest } from 'ember-qunit'; 3 4 module('Unit | Component | gauge-chart', function(hooks) { 5 setupTest(hooks); 6 7 hooks.beforeEach(function() { 8 this.subject = this.owner.factoryFor('component:gauge-chart'); 9 }); 10 11 test('percent is a function of value and total OR complement', function(assert) { 12 const chart = this.subject.create(); 13 chart.setProperties({ 14 value: 5, 15 total: 10, 16 }); 17 18 assert.equal(chart.percent, 0.5); 19 20 chart.setProperties({ 21 total: null, 22 complement: 15, 23 }); 24 25 assert.equal(chart.percent, 0.25); 26 }); 27 });