mirror of
https://github.com/prometheus/prometheus.git
synced 2026-06-05 06:32:15 -04:00
test(ui): cover PromQL URL-sensitive characters
Signed-off-by: Flying Musk <musk.flying@gmail.com>
This commit is contained in:
parent
1a7ad07bb9
commit
5261349613
1 changed files with 12 additions and 0 deletions
|
|
@ -573,6 +573,18 @@ describe("encode and decode roundtrip", () => {
|
|||
expect(decoded[0].showTree).toBe(original.showTree);
|
||||
});
|
||||
|
||||
test("roundtrip preserves PromQL expressions with URL-sensitive characters", () => {
|
||||
const expr =
|
||||
'sum by (job) (rate(http_requests_total{status!="500",handler=~"/api/v1/.+"}[5m]))';
|
||||
|
||||
const original = createPanel({ expr });
|
||||
const encoded = encodePanelOptionsToURLParams([original]);
|
||||
const decoded = decodePanelOptionsFromURLParams(encoded.toString());
|
||||
|
||||
expect(decoded).toHaveLength(1);
|
||||
expect(decoded[0].expr).toBe(expr);
|
||||
});
|
||||
|
||||
test("roundtrip preserves visualizer settings", () => {
|
||||
const original = createPanel({
|
||||
visualizer: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue