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
25c82335
Commit
25c82335
authored
Jul 04, 2018
by
Tobias Skarhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Begin conversion
parent
35efb7c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
42 deletions
+53
-42
public/app/plugins/datasource/graphite/specs/query_ctrl.jest.ts
+53
-42
No files found.
public/app/plugins/datasource/graphite/specs/query_ctrl
_specs
.ts
→
public/app/plugins/datasource/graphite/specs/query_ctrl
.jest
.ts
View file @
25c82335
...
...
@@ -6,48 +6,59 @@ import helpers from 'test/specs/helpers';
import
{
GraphiteQueryCtrl
}
from
'../query_ctrl'
;
describe
(
'GraphiteQueryCtrl'
,
function
()
{
var
ctx
=
new
helpers
.
ControllerTestContext
();
beforeEach
(
angularMocks
.
module
(
'grafana.core'
));
beforeEach
(
angularMocks
.
module
(
'grafana.controllers'
));
beforeEach
(
angularMocks
.
module
(
'grafana.services'
));
beforeEach
(
angularMocks
.
module
(
function
(
$compileProvider
)
{
$compileProvider
.
preAssignBindingsEnabled
(
true
);
})
);
beforeEach
(
ctx
.
providePhase
());
beforeEach
(
angularMocks
.
inject
((
$rootScope
,
$controller
,
$q
)
=>
{
ctx
.
$q
=
$q
;
ctx
.
scope
=
$rootScope
.
$new
();
ctx
.
target
=
{
target
:
'aliasByNode(scaleToSeconds(test.prod.*,1),2)'
};
ctx
.
datasource
.
metricFindQuery
=
sinon
.
stub
().
returns
(
ctx
.
$q
.
when
([]));
ctx
.
datasource
.
getFuncDefs
=
sinon
.
stub
().
returns
(
ctx
.
$q
.
when
(
gfunc
.
getFuncDefs
(
'1.0'
)));
ctx
.
datasource
.
getFuncDef
=
gfunc
.
getFuncDef
;
ctx
.
datasource
.
waitForFuncDefsLoaded
=
sinon
.
stub
().
returns
(
ctx
.
$q
.
when
(
null
));
ctx
.
datasource
.
createFuncInstance
=
gfunc
.
createFuncInstance
;
ctx
.
panelCtrl
=
{
panel
:
{}
};
ctx
.
panelCtrl
=
{
panel
:
{
targets
:
[
ctx
.
target
],
},
};
ctx
.
panelCtrl
.
refresh
=
sinon
.
spy
();
ctx
.
ctrl
=
$controller
(
GraphiteQueryCtrl
,
{
$scope
:
ctx
.
scope
},
{
panelCtrl
:
ctx
.
panelCtrl
,
datasource
:
ctx
.
datasource
,
target
:
ctx
.
target
,
}
);
ctx
.
scope
.
$digest
();
})
);
let
datasource
=
{
metricFindQuery
:
jest
.
fn
(()
=>
Promise
.
resolve
([])),
getFuncDefs
:
jest
.
fn
(()
=>
Promise
.
resolve
(
gfunc
.
getFuncDefs
(
'1.0'
))),
getFuncDef
:
gfunc
.
getFuncDef
,
waitForFuncDefsLoaded
:
jest
.
fn
(()
=>
Promise
.
resolve
(
null
)),
createFuncInstance
:
gfunc
.
createFuncInstance
,
};
let
ctx
=
{
};
// beforeEach(angularMocks.module('grafana.core'));
// beforeEach(angularMocks.module('grafana.controllers'));
// beforeEach(angularMocks.module('grafana.services'));
// beforeEach(
// angularMocks.module(function($compileProvider) {
// $compileProvider.preAssignBindingsEnabled(true);
// })
// );
//beforeEach(ctx.providePhase());
// beforeEach(
// angularMocks.inject(($rootScope, $controller, $q) => {
// ctx.$q = $q;
// ctx.scope = $rootScope.$new();
// ctx.target = { target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)' };
// ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([]));
// ctx.datasource.getFuncDefs = sinon.stub().returns(ctx.$q.when(gfunc.getFuncDefs('1.0')));
// ctx.datasource.getFuncDef = gfunc.getFuncDef;
// ctx.datasource.waitForFuncDefsLoaded = sinon.stub().returns(ctx.$q.when(null));
// ctx.datasource.createFuncInstance = gfunc.createFuncInstance;
// ctx.panelCtrl = { panel: {} };
// ctx.panelCtrl = {
// panel: {
// targets: [ctx.target],
// },
// };
// ctx.panelCtrl.refresh = sinon.spy();
// ctx.ctrl = $controller(
// GraphiteQueryCtrl,
// { $scope: ctx.scope },
// {
// panelCtrl: ctx.panelCtrl,
// datasource: ctx.datasource,
// target: ctx.target,
// }
// );
// ctx.scope.$digest();
// })
// );
describe
(
'init'
,
function
()
{
it
(
'should validate metric key exists'
,
function
()
{
...
...
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