mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Test passing. Remove Karma
This commit is contained in:
@@ -12,24 +12,15 @@ describe('backend_srv', function() {
|
|||||||
|
|
||||||
let _backendSrv = new BackendSrv(_httpBackend, {}, {}, {}, {});
|
let _backendSrv = new BackendSrv(_httpBackend, {}, {}, {}, {});
|
||||||
|
|
||||||
// beforeEach(angularMocks.module('grafana.core'));
|
|
||||||
// beforeEach(angularMocks.module('grafana.services'));
|
|
||||||
// beforeEach(
|
|
||||||
// angularMocks.inject(function($httpBackend, $http, backendSrv) {
|
|
||||||
// _httpBackend = $httpBackend;
|
|
||||||
// _backendSrv = backendSrv;
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
|
|
||||||
describe('when handling errors', () => {
|
describe('when handling errors', () => {
|
||||||
it('should return the http status code', async () => {
|
it('should return the http status code', async () => {
|
||||||
// _httpBackend.whenGET('gateway-error').respond(502);
|
try {
|
||||||
let res = await _backendSrv.datasourceRequest({
|
await _backendSrv.datasourceRequest({
|
||||||
url: 'gateway-error',
|
url: 'gateway-error',
|
||||||
});
|
});
|
||||||
console.log(res);
|
} catch (err) {
|
||||||
expect(res.status).toBe(502);
|
expect(err.status).toBe(502);
|
||||||
// _httpBackend.flush();
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import { describe, beforeEach, it, expect, angularMocks } from 'test/lib/common';
|
|
||||||
import 'app/core/services/backend_srv';
|
|
||||||
|
|
||||||
describe('backend_srv', function() {
|
|
||||||
var _backendSrv;
|
|
||||||
var _httpBackend;
|
|
||||||
|
|
||||||
beforeEach(angularMocks.module('grafana.core'));
|
|
||||||
beforeEach(angularMocks.module('grafana.services'));
|
|
||||||
beforeEach(
|
|
||||||
angularMocks.inject(function($httpBackend, $http, backendSrv) {
|
|
||||||
_httpBackend = $httpBackend;
|
|
||||||
_backendSrv = backendSrv;
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
describe('when handling errors', function() {
|
|
||||||
it('should return the http status code', function(done) {
|
|
||||||
_httpBackend.whenGET('gateway-error').respond(502);
|
|
||||||
_backendSrv
|
|
||||||
.datasourceRequest({
|
|
||||||
url: 'gateway-error',
|
|
||||||
})
|
|
||||||
.catch(function(err) {
|
|
||||||
expect(err.status).to.be(502);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
_httpBackend.flush();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user