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
22e0ff8b
Commit
22e0ff8b
authored
Oct 14, 2018
by
Michael Huynh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update PromQueryField tests to address fixed bug
Related: #13484
parent
a8c5ab76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
+33
-3
public/app/features/explore/PromQueryField.test.tsx
+33
-3
No files found.
public/app/features/explore/PromQueryField.test.tsx
View file @
22e0ff8b
...
...
@@ -96,11 +96,14 @@ describe('PromQueryField typeahead handling', () => {
it
(
'returns label suggestions on label context but leaves out labels that already exist'
,
()
=>
{
const
instance
=
shallow
(
<
PromQueryField
{
...
defaultProps
}
labelKeys=
{
{
'{job="foo"}'
:
[
'bar'
,
'job'
]
}
}
/>
<
PromQueryField
{
...
defaultProps
}
labelKeys=
{
{
'{job1="foo",job2!="foo",job3=~"foo"}'
:
[
'bar'
,
'job1'
,
'job2'
,
'job3'
]
}
}
/>
).
instance
()
as
PromQueryField
;
const
value
=
Plain
.
deserialize
(
'{job
=
"foo",}'
);
const
value
=
Plain
.
deserialize
(
'{job
1="foo",job2!="foo",job3=~
"foo",}'
);
const
range
=
value
.
selection
.
merge
({
anchorOffset
:
11
,
anchorOffset
:
36
,
});
const
valueWithSelection
=
value
.
change
().
select
(
range
).
value
;
const
result
=
instance
.
getTypeahead
({
...
...
@@ -113,6 +116,33 @@ describe('PromQueryField typeahead handling', () => {
expect
(
result
.
suggestions
).
toEqual
([{
items
:
[{
label
:
'bar'
}],
label
:
'Labels'
}]);
});
it
(
'returns label value suggestions inside a label value context after a negated matching operator'
,
()
=>
{
const
instance
=
shallow
(
<
PromQueryField
{
...
defaultProps
}
labelKeys=
{
{
'{}'
:
[
'label'
]
}
}
labelValues=
{
{
'{}'
:
{
label
:
[
'a'
,
'b'
,
'c'
]
}
}
}
/>
).
instance
()
as
PromQueryField
;
const
value
=
Plain
.
deserialize
(
'{label!=}'
);
const
range
=
value
.
selection
.
merge
({
anchorOffset
:
8
});
const
valueWithSelection
=
value
.
change
().
select
(
range
).
value
;
const
result
=
instance
.
getTypeahead
({
text
:
'!='
,
prefix
:
''
,
wrapperClasses
:
[
'context-labels'
],
labelKey
:
'label'
,
value
:
valueWithSelection
,
});
expect
(
result
.
context
).
toBe
(
'context-label-values'
);
expect
(
result
.
suggestions
).
toEqual
([
{
items
:
[{
label
:
'a'
},
{
label
:
'b'
},
{
label
:
'c'
}],
label
:
'Label values for "label"'
,
},
]);
});
it
(
'returns a refresher on label context and unavailable metric'
,
()
=>
{
const
instance
=
shallow
(
<
PromQueryField
{
...
defaultProps
}
labelKeys=
{
{
'{__name__="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