Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
4e6168f3
Commit
4e6168f3
authored
Jul 27, 2018
by
Tobias Skarhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add async/await
parent
67c613a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
public/app/core/specs/backend_srv.jest.ts
+9
-13
No files found.
public/app/core/specs/backend_srv.jest.ts
View file @
4e6168f3
...
@@ -3,10 +3,9 @@ jest.mock('app/core/store');
...
@@ -3,10 +3,9 @@ jest.mock('app/core/store');
describe
(
'backend_srv'
,
function
()
{
describe
(
'backend_srv'
,
function
()
{
let
_httpBackend
=
options
=>
{
let
_httpBackend
=
options
=>
{
if
(
options
.
method
===
'GET'
&&
options
.
url
===
'gateway-error'
)
{
console
.
log
(
options
);
if
(
options
.
url
===
'gateway-error'
)
{
return
Promise
.
reject
({
status
:
502
});
return
Promise
.
reject
({
status
:
502
});
}
else
if
(
options
.
method
===
'POST'
)
{
// return Promise.resolve({});
}
}
return
Promise
.
resolve
({});
return
Promise
.
resolve
({});
};
};
...
@@ -22,17 +21,14 @@ describe('backend_srv', function() {
...
@@ -22,17 +21,14 @@ describe('backend_srv', function() {
// })
// })
// );
// );
describe
(
'when handling errors'
,
function
()
{
describe
(
'when handling errors'
,
()
=>
{
it
(
'should return the http status code'
,
function
(
done
)
{
it
(
'should return the http status code'
,
async
()
=>
{
// _httpBackend.whenGET('gateway-error').respond(502);
// _httpBackend.whenGET('gateway-error').respond(502);
_backendSrv
let
res
=
await
_backendSrv
.
datasourceRequest
({
.
datasourceRequest
({
url
:
'gateway-error'
,
url
:
'gateway-error'
,
});
})
console
.
log
(
res
);
.
catch
(
function
(
err
)
{
expect
(
res
.
status
).
toBe
(
502
);
expect
(
err
.
status
).
toBe
(
502
);
done
();
});
// _httpBackend.flush();
// _httpBackend.flush();
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment