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';
...
@@ -5,7 +5,6 @@ import CloudWatchDatasource from '../datasource';
import
'app/features/dashboard/time_srv'
;
import
'app/features/dashboard/time_srv'
;
describe
(
'CloudWatchDatasource'
,
function
()
{
describe
(
'CloudWatchDatasource'
,
function
()
{
let
instanceSettings
=
{
let
instanceSettings
=
{
jsonData
:
{
defaultRegion
:
'us-east-1'
,
access
:
'proxy'
},
jsonData
:
{
defaultRegion
:
'us-east-1'
,
access
:
'proxy'
},
};
};
...
@@ -14,29 +13,12 @@ describe('CloudWatchDatasource', function() {
...
@@ -14,29 +13,12 @@ describe('CloudWatchDatasource', function() {
let
backendSrv
=
{};
let
backendSrv
=
{};
let
ctx
=
<
any
>
{
let
ctx
=
<
any
>
{
backendSrv
,
backendSrv
,
templateSrv
templateSrv
,
};
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
ctx
.
ds
=
new
CloudWatchDatasource
(
instanceSettings
,
{},
backendSrv
,
templateSrv
,
timeSrv
);
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
()
{
describe
(
'When performing CloudWatch query'
,
function
()
{
var
requestParams
;
var
requestParams
;
...
@@ -78,7 +60,7 @@ describe('CloudWatchDatasource', function() {
...
@@ -78,7 +60,7 @@ describe('CloudWatchDatasource', function() {
};
};
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
await
jest
.
fn
(
(
params
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
await
jest
.
fn
(
params
=>
{
requestParams
=
params
.
data
;
requestParams
=
params
.
data
;
return
Promise
.
resolve
({
data
:
response
});
return
Promise
.
resolve
({
data
:
response
});
});
});
...
@@ -94,7 +76,6 @@ describe('CloudWatchDatasource', function() {
...
@@ -94,7 +76,6 @@ describe('CloudWatchDatasource', function() {
expect
(
params
.
period
).
toBe
(
query
.
targets
[
0
].
period
);
expect
(
params
.
period
).
toBe
(
query
.
targets
[
0
].
period
);
done
();
done
();
});
});
//ctx.$rootScope.$apply();
});
});
it
(
'should generate the correct query with interval variable'
,
function
(
done
)
{
it
(
'should generate the correct query with interval variable'
,
function
(
done
)
{
...
@@ -124,7 +105,6 @@ describe('CloudWatchDatasource', function() {
...
@@ -124,7 +105,6 @@ describe('CloudWatchDatasource', function() {
expect
(
params
.
period
).
toBe
(
'600'
);
expect
(
params
.
period
).
toBe
(
'600'
);
done
();
done
();
});
});
//ctx.$rootScope.$apply();
});
});
it
(
'should return series list'
,
function
(
done
)
{
it
(
'should return series list'
,
function
(
done
)
{
...
@@ -133,7 +113,6 @@ describe('CloudWatchDatasource', function() {
...
@@ -133,7 +113,6 @@ describe('CloudWatchDatasource', function() {
expect
(
result
.
data
[
0
].
datapoints
[
0
][
0
]).
toBe
(
response
.
results
.
A
.
series
[
0
].
points
[
0
][
0
]);
expect
(
result
.
data
[
0
].
datapoints
[
0
][
0
]).
toBe
(
response
.
results
.
A
.
series
[
0
].
points
[
0
][
0
]);
done
();
done
();
});
});
//ctx.$rootScope.$apply();
});
});
it
(
'should generate the correct targets by expanding template variables'
,
function
()
{
it
(
'should generate the correct targets by expanding template variables'
,
function
()
{
...
@@ -249,7 +228,7 @@ describe('CloudWatchDatasource', function() {
...
@@ -249,7 +228,7 @@ describe('CloudWatchDatasource', function() {
var
requestParams
;
var
requestParams
;
beforeEach
(
function
()
{
beforeEach
(
function
()
{
ctx
.
ds
.
performTimeSeriesQuery
=
jest
.
fn
(
(
request
)
=>
{
ctx
.
ds
.
performTimeSeriesQuery
=
jest
.
fn
(
request
=>
{
requestParams
=
request
;
requestParams
=
request
;
return
Promise
.
resolve
({
data
:
{}
});
return
Promise
.
resolve
({
data
:
{}
});
});
});
...
@@ -277,7 +256,6 @@ describe('CloudWatchDatasource', function() {
...
@@ -277,7 +256,6 @@ describe('CloudWatchDatasource', function() {
expect
(
requestParams
.
queries
[
0
].
region
).
toBe
(
instanceSettings
.
jsonData
.
defaultRegion
);
expect
(
requestParams
.
queries
[
0
].
region
).
toBe
(
instanceSettings
.
jsonData
.
defaultRegion
);
done
();
done
();
});
});
//ctx.$rootScope.$apply();
});
});
});
});
...
@@ -321,7 +299,7 @@ describe('CloudWatchDatasource', function() {
...
@@ -321,7 +299,7 @@ describe('CloudWatchDatasource', function() {
};
};
beforeEach
(
function
()
{
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
params
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
params
=>
{
return
Promise
.
resolve
({
data
:
response
});
return
Promise
.
resolve
({
data
:
response
});
});
});
});
});
...
@@ -332,7 +310,6 @@ describe('CloudWatchDatasource', function() {
...
@@ -332,7 +310,6 @@ describe('CloudWatchDatasource', function() {
expect
(
result
.
data
[
0
].
datapoints
[
0
][
0
]).
toBe
(
response
.
results
.
A
.
series
[
0
].
points
[
0
][
0
]);
expect
(
result
.
data
[
0
].
datapoints
[
0
][
0
]).
toBe
(
response
.
results
.
A
.
series
[
0
].
points
[
0
][
0
]);
done
();
done
();
});
});
//ctx.$rootScope.$apply();
});
});
});
});
...
@@ -342,14 +319,13 @@ describe('CloudWatchDatasource', function() {
...
@@ -342,14 +319,13 @@ describe('CloudWatchDatasource', function() {
scenario
.
setup
=
setupCallback
=>
{
scenario
.
setup
=
setupCallback
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
setupCallback
();
setupCallback
();
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
args
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
args
=>
{
scenario
.
request
=
args
.
data
;
scenario
.
request
=
args
.
data
;
return
Promise
.
resolve
({
data
:
scenario
.
requestResponse
});
return
Promise
.
resolve
({
data
:
scenario
.
requestResponse
});
});
});
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
args
=>
{
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
args
=>
{
scenario
.
result
=
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