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
74bf8096
Commit
74bf8096
authored
Jul 04, 2018
by
Tobias Skarhed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mock to test files
parent
962340bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
26 deletions
+19
-26
public/app/plugins/datasource/cloudwatch/specs/datasource.jest.ts
+12
-3
public/app/plugins/datasource/mysql/specs/datasource.jest.ts
+4
-3
public/app/plugins/datasource/postgres/specs/datasource.jest.ts
+3
-2
public/test/specs/helpers.ts
+0
-18
No files found.
public/app/plugins/datasource/cloudwatch/specs/datasource.jest.ts
View file @
74bf8096
import
'../datasource'
;
import
'../datasource'
;
//import { describe, beforeEach, it, expect, angularMocks } from 'test/lib/common';
import
{
TemplateSrvStub
}
from
'test/specs/helpers'
;
import
{
TemplateSrvStub
,
jestTimeSrvStub
}
from
'test/specs/helpers'
;
import
CloudWatchDatasource
from
'../datasource'
;
import
CloudWatchDatasource
from
'../datasource'
;
import
'app/features/dashboard/time_srv'
;
import
'app/features/dashboard/time_srv'
;
import
*
as
dateMath
from
'app/core/utils/datemath'
;
describe
(
'CloudWatchDatasource'
,
function
()
{
describe
(
'CloudWatchDatasource'
,
function
()
{
let
instanceSettings
=
{
let
instanceSettings
=
{
jsonData
:
{
defaultRegion
:
'us-east-1'
,
access
:
'proxy'
},
jsonData
:
{
defaultRegion
:
'us-east-1'
,
access
:
'proxy'
},
};
};
let
templateSrv
=
new
TemplateSrvStub
();
let
templateSrv
=
new
TemplateSrvStub
();
let
timeSrv
=
new
jestTimeSrvStub
();
let
timeSrv
=
{
time
:
{
from
:
'now-1h'
,
to
:
'now'
},
timeRange
:
jest
.
fn
(()
=>
{
return
{
from
:
dateMath
.
parse
(
timeSrv
.
time
.
from
,
false
),
to
:
dateMath
.
parse
(
timeSrv
.
time
.
to
,
true
),
};
}),
};
let
backendSrv
=
{};
let
backendSrv
=
{};
let
ctx
=
<
any
>
{
let
ctx
=
<
any
>
{
backendSrv
,
backendSrv
,
...
...
public/app/plugins/datasource/mysql/specs/datasource.jest.ts
View file @
74bf8096
//import { describe, beforeEach, it, expect, angularMocks } from 'test/lib/common';
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
TemplateSrvStub
}
from
'test/specs/helpers'
;
import
{
MysqlDatasource
}
from
'../datasource'
;
import
{
MysqlDatasource
}
from
'../datasource'
;
import
{
CustomVariable
}
from
'app/features/templating/custom_variable'
;
import
{
CustomVariable
}
from
'app/features/templating/custom_variable'
;
describe
(
'MySQLDatasource'
,
function
()
{
describe
(
'MySQLDatasource'
,
function
()
{
let
instanceSettings
=
{
name
:
'mysql'
};
let
instanceSettings
=
{
name
:
'mysql'
};
let
backendSrv
=
{};
let
backendSrv
=
{};
let
templateSrv
=
new
TemplateSrvStub
();
let
templateSrv
=
{
replace
:
jest
.
fn
(
text
=>
text
),
};
let
ctx
=
<
any
>
{
let
ctx
=
<
any
>
{
backendSrv
,
backendSrv
,
};
};
...
...
public/app/plugins/datasource/postgres/specs/datasource.jest.ts
View file @
74bf8096
import
moment
from
'moment'
;
import
moment
from
'moment'
;
import
{
PostgresDatasource
}
from
'../datasource'
;
import
{
PostgresDatasource
}
from
'../datasource'
;
import
{
CustomVariable
}
from
'app/features/templating/custom_variable'
;
import
{
CustomVariable
}
from
'app/features/templating/custom_variable'
;
import
{
TemplateSrvStub
}
from
'test/specs/helpers'
;
describe
(
'PostgreSQLDatasource'
,
function
()
{
describe
(
'PostgreSQLDatasource'
,
function
()
{
let
instanceSettings
=
{
name
:
'postgresql'
};
let
instanceSettings
=
{
name
:
'postgresql'
};
let
backendSrv
=
{};
let
backendSrv
=
{};
let
templateSrv
=
new
TemplateSrvStub
();
let
templateSrv
=
{
replace
:
jest
.
fn
(
text
=>
text
),
};
let
ctx
=
<
any
>
{
let
ctx
=
<
any
>
{
backendSrv
,
backendSrv
,
};
};
...
...
public/test/specs/helpers.ts
View file @
74bf8096
...
@@ -195,24 +195,6 @@ export function TemplateSrvStub() {
...
@@ -195,24 +195,6 @@ export function TemplateSrvStub() {
};
};
}
}
export
function
jestTimeSrvStub
()
{
this
.
init
=
jest
.
fn
();
this
.
time
=
{
from
:
'now-1h'
,
to
:
'now'
};
this
.
timeRange
=
jest
.
fn
(
parse
=>
{
if
(
parse
===
false
)
{
return
this
.
time
;
}
return
{
from
:
dateMath
.
parse
(
this
.
time
.
from
,
false
),
to
:
dateMath
.
parse
(
this
.
time
.
to
,
true
),
};
});
this
.
replace
=
jest
.
fn
(
target
=>
target
);
this
.
setTime
=
jest
.
fn
(
time
=>
{
this
.
time
=
time
;
});
}
var
allDeps
=
{
var
allDeps
=
{
ContextSrvStub
,
ContextSrvStub
,
TemplateSrvStub
,
TemplateSrvStub
,
...
...
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