Files
redash/client/app/services/parameters/tests/TextParameter.test.js
Arik Fraimovich 56d3be2248 Prettier all the Javascript code & GitHub Action (#4433)
* 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
2019-12-11 17:05:38 +02:00

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();
});
});
});
});