mirror of
https://github.com/getredash/redash.git
synced 2026-03-21 16:00:09 -04:00
Co-authored-by: Ezra Odio <eodio@starfishstorage.com> Co-authored-by: Restyled.io <commits@restyled.io>
22 lines
602 B
JavaScript
22 lines
602 B
JavaScript
import { createParameter } from "..";
|
|
|
|
describe("TextPatternParameter", () => {
|
|
let param;
|
|
|
|
beforeEach(() => {
|
|
param = createParameter({ name: "param", title: "Param", type: "text-pattern", regex: "a+" });
|
|
});
|
|
|
|
describe("noramlizeValue", () => {
|
|
test("converts matching strings", () => {
|
|
const normalizedValue = param.normalizeValue("art");
|
|
expect(normalizedValue).toBe("art");
|
|
});
|
|
|
|
test("returns null when string does not match pattern", () => {
|
|
const normalizedValue = param.normalizeValue("brt");
|
|
expect(normalizedValue).toBeNull();
|
|
});
|
|
});
|
|
});
|