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
a37a0c7b
Commit
a37a0c7b
authored
Jul 03, 2018
by
Tobias Skarhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove comments
parent
42ba0dc7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
29 deletions
+5
-29
public/app/plugins/datasource/cloudwatch/specs/datasource.jest.ts
+5
-29
No files found.
public/app/plugins/datasource/cloudwatch/specs/datasource.jest.ts
View file @
a37a0c7b
...
...
@@ -5,7 +5,6 @@ import CloudWatchDatasource from '../datasource';
import
'app/features/dashboard/time_srv'
;
describe
(
'CloudWatchDatasource'
,
function
()
{
let
instanceSettings
=
{
jsonData
:
{
defaultRegion
:
'us-east-1'
,
access
:
'proxy'
},
};
...
...
@@ -14,29 +13,12 @@ describe('CloudWatchDatasource', function() {
let
backendSrv
=
{};
let
ctx
=
<
any
>
{
backendSrv
,
templateSrv
templateSrv
,
};
beforeEach
(()
=>
{
ctx
.
ds
=
new
CloudWatchDatasource
(
instanceSettings
,
{},
backendSrv
,
templateSrv
,
timeSrv
);
});
// beforeEach(angularMocks.module('grafana.core'));
// beforeEach(angularMocks.module('grafana.services'));
// beforeEach(angularMocks.module('grafana.controllers'));
// beforeEach(ctx.providePhase(['templateSrv', 'backendSrv']));
// beforeEach(ctx.createService('timeSrv'));
// beforeEach(
// angularMocks.inject(function($q, $rootScope, $httpBackend, $injector) {
// ctx.$q = $q;
// ctx.$httpBackend = $httpBackend;
// ctx.$rootScope = $rootScope;
// ctx.ds = $injector.instantiate(CloudWatchDatasource, {
// instanceSettings: instanceSettings,
// });
// $httpBackend.when('GET', /\.html$/).respond('');
// })
// );
describe
(
'When performing CloudWatch query'
,
function
()
{
var
requestParams
;
...
...
@@ -78,7 +60,7 @@ describe('CloudWatchDatasource', function() {
};
beforeEach
(
async
()
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
await
jest
.
fn
(
(
params
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
await
jest
.
fn
(
params
=>
{
requestParams
=
params
.
data
;
return
Promise
.
resolve
({
data
:
response
});
});
...
...
@@ -94,7 +76,6 @@ describe('CloudWatchDatasource', function() {
expect
(
params
.
period
).
toBe
(
query
.
targets
[
0
].
period
);
done
();
});
//ctx.$rootScope.$apply();
});
it
(
'should generate the correct query with interval variable'
,
function
(
done
)
{
...
...
@@ -124,7 +105,6 @@ describe('CloudWatchDatasource', function() {
expect
(
params
.
period
).
toBe
(
'600'
);
done
();
});
//ctx.$rootScope.$apply();
});
it
(
'should return series list'
,
function
(
done
)
{
...
...
@@ -133,7 +113,6 @@ describe('CloudWatchDatasource', function() {
expect
(
result
.
data
[
0
].
datapoints
[
0
][
0
]).
toBe
(
response
.
results
.
A
.
series
[
0
].
points
[
0
][
0
]);
done
();
});
//ctx.$rootScope.$apply();
});
it
(
'should generate the correct targets by expanding template variables'
,
function
()
{
...
...
@@ -249,7 +228,7 @@ describe('CloudWatchDatasource', function() {
var
requestParams
;
beforeEach
(
function
()
{
ctx
.
ds
.
performTimeSeriesQuery
=
jest
.
fn
(
(
request
)
=>
{
ctx
.
ds
.
performTimeSeriesQuery
=
jest
.
fn
(
request
=>
{
requestParams
=
request
;
return
Promise
.
resolve
({
data
:
{}
});
});
...
...
@@ -277,7 +256,6 @@ describe('CloudWatchDatasource', function() {
expect
(
requestParams
.
queries
[
0
].
region
).
toBe
(
instanceSettings
.
jsonData
.
defaultRegion
);
done
();
});
//ctx.$rootScope.$apply();
});
});
...
...
@@ -321,7 +299,7 @@ describe('CloudWatchDatasource', function() {
};
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
params
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
params
=>
{
return
Promise
.
resolve
({
data
:
response
});
});
});
...
...
@@ -332,7 +310,6 @@ describe('CloudWatchDatasource', function() {
expect
(
result
.
data
[
0
].
datapoints
[
0
][
0
]).
toBe
(
response
.
results
.
A
.
series
[
0
].
points
[
0
][
0
]);
done
();
});
//ctx.$rootScope.$apply();
});
});
...
...
@@ -342,14 +319,13 @@ describe('CloudWatchDatasource', function() {
scenario
.
setup
=
setupCallback
=>
{
beforeEach
(()
=>
{
setupCallback
();
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
args
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
args
=>
{
scenario
.
request
=
args
.
data
;
return
Promise
.
resolve
({
data
:
scenario
.
requestResponse
});
});
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
args
=>
{
scenario
.
result
=
args
;
});
//ctx.$rootScope.$apply();
});
};
...
...
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