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
962340bc
Commit
962340bc
authored
Jul 03, 2018
by
Tobias Skarhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create new instance in beforeEach
parent
a37a0c7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
public/app/plugins/datasource/mysql/specs/datasource.jest.ts
+9
-7
public/app/plugins/datasource/postgres/specs/datasource.jest.ts
+9
-6
No files found.
public/app/plugins/datasource/mysql/specs/datasource.jest.ts
View file @
962340bc
...
...
@@ -5,15 +5,17 @@ import { MysqlDatasource } from '../datasource';
import
{
CustomVariable
}
from
'app/features/templating/custom_variable'
;
describe
(
'MySQLDatasource'
,
function
()
{
let
instanceSettings
=
{
name
:
'mysql'
};
let
backendSrv
=
{};
let
templateSrv
=
new
TemplateSrvStub
();
let
ctx
=
<
any
>
{
ds
:
new
MysqlDatasource
(
instanceSettings
,
backendSrv
,
{},
templateSrv
),
backendSrv
backendSrv
,
};
beforeEach
(()
=>
{
ctx
.
ds
=
new
MysqlDatasource
(
instanceSettings
,
backendSrv
,
{},
templateSrv
);
});
describe
(
'When performing annotationQuery'
,
function
()
{
let
results
;
...
...
@@ -49,7 +51,7 @@ describe('MySQLDatasource', function() {
};
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
options
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
options
=>
{
return
Promise
.
resolve
({
data
:
response
,
status
:
200
});
});
ctx
.
ds
.
annotationQuery
(
options
).
then
(
function
(
data
)
{
...
...
@@ -92,7 +94,7 @@ describe('MySQLDatasource', function() {
};
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
options
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
options
=>
{
return
Promise
.
resolve
({
data
:
response
,
status
:
200
});
});
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
data
)
{
...
...
@@ -128,7 +130,7 @@ describe('MySQLDatasource', function() {
};
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
options
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
options
=>
{
return
Promise
.
resolve
({
data
:
response
,
status
:
200
});
});
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
data
)
{
...
...
@@ -166,7 +168,7 @@ describe('MySQLDatasource', function() {
};
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
options
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
options
=>
{
return
Promise
.
resolve
({
data
:
response
,
status
:
200
});
});
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
data
)
{
...
...
public/app/plugins/datasource/postgres/specs/datasource.jest.ts
View file @
962340bc
...
...
@@ -9,10 +9,13 @@ describe('PostgreSQLDatasource', function() {
let
backendSrv
=
{};
let
templateSrv
=
new
TemplateSrvStub
();
let
ctx
=
<
any
>
{
ds
:
new
PostgresDatasource
(
instanceSettings
,
backendSrv
,
{},
templateSrv
),
backendSrv
backendSrv
,
};
beforeEach
(()
=>
{
ctx
.
ds
=
new
PostgresDatasource
(
instanceSettings
,
backendSrv
,
{},
templateSrv
);
});
describe
(
'When performing annotationQuery'
,
function
()
{
let
results
;
...
...
@@ -48,7 +51,7 @@ describe('PostgreSQLDatasource', function() {
};
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
options
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
options
=>
{
return
Promise
.
resolve
({
data
:
response
,
status
:
200
});
});
ctx
.
ds
.
annotationQuery
(
options
).
then
(
function
(
data
)
{
...
...
@@ -91,7 +94,7 @@ describe('PostgreSQLDatasource', function() {
};
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
options
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
options
=>
{
return
Promise
.
resolve
({
data
:
response
,
status
:
200
});
});
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
data
)
{
...
...
@@ -127,7 +130,7 @@ describe('PostgreSQLDatasource', function() {
};
beforeEach
(
function
()
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
options
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
options
=>
{
return
Promise
.
resolve
({
data
:
response
,
status
:
200
});
});
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
data
)
{
...
...
@@ -165,7 +168,7 @@ describe('PostgreSQLDatasource', function() {
};
beforeEach
(()
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
(
options
)
=>
{
ctx
.
backendSrv
.
datasourceRequest
=
jest
.
fn
(
options
=>
{
return
Promise
.
resolve
({
data
:
response
,
status
:
200
});
});
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
data
)
{
...
...
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