From 55bd7748670c3f346ac875777fa67b62b2debf5a Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Thu, 28 May 2015 16:44:07 -0400 Subject: [PATCH] fixed dashboard graph karma tests --- .../unit/directives/job-status-graph-test.js | 3 +- .../services/host-count-graph-data-test.js | 56 ------------------- .../services/job-status-graph-data-test.js | 3 +- 3 files changed, 4 insertions(+), 58 deletions(-) delete mode 100644 awx/ui/tests/unit/services/host-count-graph-data-test.js diff --git a/awx/ui/tests/unit/directives/job-status-graph-test.js b/awx/ui/tests/unit/directives/job-status-graph-test.js index 5f53d3681a..a7bdc72970 100644 --- a/awx/ui/tests/unit/directives/job-status-graph-test.js +++ b/awx/ui/tests/unit/directives/job-status-graph-test.js @@ -1,9 +1,10 @@ import Tower from 'tower/app'; import {describeModule} from 'tests/unit/describe-module'; +import JobStatusGraph from 'tower/dashboard/graphs/job-status/main' var resizeHandler = sinon.spy(); -describeModule('DashboardGraphs') +describeModule(JobStatusGraph.name) .mockProvider('adjustGraphSize', resizeHandler) .testDirective('jobStatusGraph', function(directive) { diff --git a/awx/ui/tests/unit/services/host-count-graph-data-test.js b/awx/ui/tests/unit/services/host-count-graph-data-test.js deleted file mode 100644 index 7769bf7a3f..0000000000 --- a/awx/ui/tests/unit/services/host-count-graph-data-test.js +++ /dev/null @@ -1,56 +0,0 @@ -import {describeModule} from 'tests/unit/describe-module'; - -var processErrors = sinon.spy(); - -describeModule('DashboardGraphs') - .mockProvider('ProcessErrors', processErrors) - .testService('hostCountGraphData', function(test, restStub) { - - var q; - var service; - - beforeEach(inject(['$q', function($q) { - q = $q; - }])); - - - test.withService(function(_service_) { - service = _service_; - }); - - it('returns a promise to be fulfilled when data comes in', function() { - var license = "license"; - var hostData = "hosts"; - - var result = service.get(); - - restStub.succeedAt('/config/', { data: { - license_info: { - instance_count: license - } - } - }); - - restStub.succeedAt('/dashboard/graphs/inventory/', { data: hostData }); - - restStub.flush(); - - return expect(result).to.eventually.eql({ license: license, hosts: hostData });; - }); - - it('processes errors through error handler', function() { - var expected = { data: "blah", status: "bad" }; - var actual = service.get(); - - restStub.failAt('/config/', expected); - - restStub.flush(); - - return actual.catch(function() { - expect(processErrors).to - .have.been.calledWith(null, expected.data, expected.status); - }); - - }); - }); - diff --git a/awx/ui/tests/unit/services/job-status-graph-data-test.js b/awx/ui/tests/unit/services/job-status-graph-data-test.js index 42babc9ee8..74d4919bf6 100644 --- a/awx/ui/tests/unit/services/job-status-graph-data-test.js +++ b/awx/ui/tests/unit/services/job-status-graph-data-test.js @@ -1,8 +1,9 @@ import {describeModule} from 'tests/unit/describe-module'; +import JobStatusGraph from 'tower/dashboard/graphs/job-status/main' var processErrors = sinon.spy(); -describeModule('DashboardGraphs') +describeModule(JobStatusGraph.name) .mockProvider('ProcessErrors', processErrors) .testService('jobStatusGraphData', function(test, restStub) { var q;