mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
fixed dashboard graph karma tests
This commit is contained in:
parent
12af62f671
commit
55bd774867
@ -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) {
|
||||
|
||||
|
||||
@ -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);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user