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
987a1608
Commit
987a1608
authored
Jul 24, 2018
by
Tobias Skarhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Karma to Jest
parent
81c32780
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
56 deletions
+14
-56
public/app/plugins/datasource/influxdb/specs/query_ctrl.jest.ts
+14
-56
No files found.
public/app/plugins/datasource/influxdb/specs/query_ctrl.jest.ts
View file @
987a1608
import
'../query_ctrl'
;
import
'app/core/services/segment_srv'
;
import
{
uiSegmentSrv
}
from
'app/core/services/segment_srv'
;
// import { describe, beforeEach, it, sinon, expect, angularMocks } from 'test/lib/common';
// import helpers from 'test/specs/helpers';
import
{
InfluxQueryCtrl
}
from
'../query_ctrl'
;
describe
(
'InfluxDBQueryCtrl'
,
()
=>
{
let
uiSegmentSrv
=
{
newPlusButton
:
()
=>
{},
newKey
:
key
=>
key
,
newKeyValue
:
key
=>
key
,
newSegment
:
seg
=>
seg
,
newSelectMeasurement
:
()
=>
{
return
{
value
:
'select measurement'
};
},
newOperator
:
op
=>
op
,
newFake
:
()
=>
{},
};
let
ctx
=
<
any
>
{
dataSource
:
{},
};
let
ctx
=
<
any
>
{};
// beforeEach(angularMocks.module('grafana.core'));
// beforeEach(angularMocks.module('grafana.controllers'));
// beforeEach(angularMocks.module('grafana.services'));
// beforeEach(
// angularMocks.module(($ =>compileProvider) {
// $compileProvider.preAssignBindingsEnabled(true);
// })
// );
// beforeEach(ctx.providePhase());
// beforeEach(
// angularMocks.inject(($rootScope, $controller, $q) => {
// ctx.$q = $q;
// ctx.scope = $rootScope.$new();
// ctx.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([]));
// ctx.target = { target: {} };
// ctx.panelCtrl = {
// panel: {
// targets: [ctx.target],
// },
// };
// ctx.panelCtrl.refresh = sinon.spy();
// ctx.ctrl = $controller(
// InfluxQueryCtrl,
// { $scope: ctx.scope },
// {
// panelCtrl: ctx.panelCtrl,
// target: ctx.target,
// datasource: ctx.datasource,
// }
// );
// })
// );
beforeEach
(
async
()
=>
{
beforeEach
(()
=>
{
InfluxQueryCtrl
.
prototype
.
datasource
=
{
metricFindQuery
:
jest
.
fn
(()
=>
Promise
.
resolve
([])
),
metricFindQuery
:
()
=>
Promise
.
resolve
([]
),
};
InfluxQueryCtrl
.
prototype
.
target
=
{
target
:
{}
};
InfluxQueryCtrl
.
prototype
.
panelCtrl
=
{
panel
:
{
targets
:
[
InfluxQueryCtrl
.
target
],
targets
:
[
InfluxQueryCtrl
.
prototype
.
target
],
},
refresh
:
()
=>
{},
};
InfluxQueryCtrl
.
prototype
.
target
=
{
target
:
{}
};
console
.
log
(
'creating new instance'
);
ctx
.
ctrl
=
await
new
InfluxQueryCtrl
({},
{},
{},
{},
uiSegmentSrv
);
ctx
.
ctrl
=
new
InfluxQueryCtrl
(
{},
{},
{},
{},
new
uiSegmentSrv
({
trustAsHtml
:
html
=>
html
},
{
highlightVariablesAsHtml
:
()
=>
{}
})
);
});
describe
(
'init'
,
()
=>
{
...
...
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