mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 01:00:14 -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
27 lines
713 B
JavaScript
27 lines
713 B
JavaScript
import { Parameter } from "..";
|
|
|
|
describe("NumberParameter", () => {
|
|
let param;
|
|
|
|
beforeEach(() => {
|
|
param = Parameter.create({ name: "param", title: "Param", type: "number" });
|
|
});
|
|
|
|
describe("normalizeValue", () => {
|
|
test("converts Strings", () => {
|
|
const normalizedValue = param.normalizeValue("15");
|
|
expect(normalizedValue).toBe(15);
|
|
});
|
|
|
|
test("converts Numbers", () => {
|
|
const normalizedValue = param.normalizeValue(42);
|
|
expect(normalizedValue).toBe(42);
|
|
});
|
|
|
|
test("returns null when not possible to convert to number", () => {
|
|
const normalizedValue = param.normalizeValue("notanumber");
|
|
expect(normalizedValue).toBeNull();
|
|
});
|
|
});
|
|
});
|