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
ec94dfa8
Commit
ec94dfa8
authored
Oct 31, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: migrated tests for link_srv to jest, #9666
parent
f097bce5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
50 deletions
+4
-50
public/app/features/panellinks/link_srv.ts
+4
-4
public/app/features/panellinks/specs/link_srv_specs.ts
+0
-46
No files found.
public/app/features/panellinks/link_srv.ts
View file @
ec94dfa8
...
...
@@ -5,8 +5,7 @@ import kbn from 'app/core/utils/kbn';
export
class
LinkSrv
{
/** @ngInject */
constructor
(
private
templateSrv
,
private
timeSrv
)
{
}
constructor
(
private
templateSrv
,
private
timeSrv
)
{}
getLinkUrl
(
link
)
{
var
url
=
this
.
templateSrv
.
replace
(
link
.
url
||
''
);
...
...
@@ -29,7 +28,9 @@ export class LinkSrv {
var
paramsArray
=
[];
_
.
each
(
params
,
function
(
value
,
key
)
{
if
(
value
===
null
)
{
return
;
}
if
(
value
===
null
)
{
return
;
}
if
(
value
===
true
)
{
paramsArray
.
push
(
key
);
}
else
if
(
_
.
isArray
(
value
))
{
...
...
@@ -107,7 +108,6 @@ export class LinkSrv {
return
info
;
}
}
angular
.
module
(
'grafana.services'
).
service
(
'linkSrv'
,
LinkSrv
);
public/app/features/panellinks/specs/link_srv_specs.ts
deleted
100644 → 0
View file @
f097bce5
import
{
describe
,
beforeEach
,
it
,
expect
,
angularMocks
}
from
'test/lib/common'
;
import
'app/features/panellinks/link_srv'
;
import
_
from
'lodash'
;
describe
(
'linkSrv'
,
function
()
{
var
_linkSrv
;
beforeEach
(
angularMocks
.
module
(
'grafana.core'
));
beforeEach
(
angularMocks
.
module
(
'grafana.services'
));
beforeEach
(
angularMocks
.
inject
(
function
(
linkSrv
)
{
_linkSrv
=
linkSrv
;
}));
describe
(
'when appending query strings'
,
function
()
{
it
(
'add ? to URL if not present'
,
function
()
{
var
url
=
_linkSrv
.
appendToQueryString
(
'http://example.com'
,
'foo=bar'
);
expect
(
url
).
to
.
be
(
'http://example.com?foo=bar'
);
});
it
(
'do not add & to URL if ? is present but query string is empty'
,
function
()
{
var
url
=
_linkSrv
.
appendToQueryString
(
'http://example.com?'
,
'foo=bar'
);
expect
(
url
).
to
.
be
(
'http://example.com?foo=bar'
);
});
it
(
'add & to URL if query string is present'
,
function
()
{
var
url
=
_linkSrv
.
appendToQueryString
(
'http://example.com?foo=bar'
,
'hello=world'
);
expect
(
url
).
to
.
be
(
'http://example.com?foo=bar&hello=world'
);
});
it
(
'do not change the URL if there is nothing to append'
,
function
()
{
_
.
each
([
''
,
undefined
,
null
],
function
(
toAppend
)
{
var
url1
=
_linkSrv
.
appendToQueryString
(
'http://example.com'
,
toAppend
);
expect
(
url1
).
to
.
be
(
'http://example.com'
);
var
url2
=
_linkSrv
.
appendToQueryString
(
'http://example.com?'
,
toAppend
);
expect
(
url2
).
to
.
be
(
'http://example.com?'
);
var
url3
=
_linkSrv
.
appendToQueryString
(
'http://example.com?foo=bar'
,
toAppend
);
expect
(
url3
).
to
.
be
(
'http://example.com?foo=bar'
);
});
});
});
});
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