mirror of
https://github.com/getredash/redash.git
synced 2026-03-21 16:00:09 -04:00
* Prettier all the JS files * Add GitHub Action to autoformat code pushed to master * Fix eslint violation due to formatting. * Remove GitHub actions for styling * Add restyled.io config
31 lines
844 B
JavaScript
31 lines
844 B
JavaScript
import { Parameter } from "..";
|
|
|
|
describe("TextParameter", () => {
|
|
let param;
|
|
|
|
beforeEach(() => {
|
|
param = Parameter.create({ name: "param", title: "Param", type: "text" });
|
|
});
|
|
|
|
describe("normalizeValue", () => {
|
|
test("converts Strings", () => {
|
|
const normalizedValue = param.normalizeValue("exampleString");
|
|
expect(normalizedValue).toBe("exampleString");
|
|
});
|
|
|
|
test("converts Numbers", () => {
|
|
const normalizedValue = param.normalizeValue(3);
|
|
expect(normalizedValue).toBe("3");
|
|
});
|
|
|
|
describe("Empty values", () => {
|
|
const emptyValues = [null, undefined, ""];
|
|
|
|
test.each(emptyValues)("normalizes empty value '%s' as null", emptyValue => {
|
|
const normalizedValue = param.normalizeValue(emptyValue);
|
|
expect(normalizedValue).toBeNull();
|
|
});
|
|
});
|
|
});
|
|
});
|