Farmbot-Web-App/webpack/farm_designer/__tests__/index_test.ts
Gabriel Burnworth beddbf9c0b Cleanup and tests (#953)
* tslint cleanup

* app crash page improvements

* fix long lines

* remove unused auth code

* add more tests

* add tslint to scripts and fix deprecations
2018-08-08 09:44:12 -05:00

44 lines
1.4 KiB
TypeScript

import { getDefaultAxisLength, getGridSize } from "../index";
import { WebAppConfig } from "../../config_storage/web_app_configs";
describe("getDefaultAxisLength()", () => {
it("returns axis lengths", () => {
const axes = getDefaultAxisLength(() => false);
expect(axes).toEqual({ x: 2900, y: 1400 });
});
it("returns XL axis lengths", () => {
const axes = getDefaultAxisLength(() => true);
expect(axes).toEqual({ x: 5900, y: 2900 });
});
});
describe("getGridSize()", () => {
it("returns default grid size", () => {
const grid = getGridSize(
k => ({ dynamic_map: false, map_xl: false } as WebAppConfig)[k], {
x: { value: 100, isDefault: false },
y: { value: 200, isDefault: false }
});
expect(grid).toEqual({ x: 2900, y: 1400 });
});
it("returns XL grid size", () => {
const grid = getGridSize(
k => ({ dynamic_map: false, map_xl: true } as WebAppConfig)[k], {
x: { value: 100, isDefault: false },
y: { value: 200, isDefault: false }
});
expect(grid).toEqual({ x: 5900, y: 2900 });
});
it("returns grid size using bot size", () => {
const grid = getGridSize(
k => ({ dynamic_map: true, map_xl: false } as WebAppConfig)[k], {
x: { value: 100, isDefault: false },
y: { value: 200, isDefault: false }
});
expect(grid).toEqual({ x: 100, y: 200 });
});
});