Type error, TODO: Get tool_slots out of resource list.
parent
9997a98c97
commit
c9b76711df
|
@ -0,0 +1,36 @@
|
|||
import { resourceUpdate } from "../assertion_support";
|
||||
import { packStep } from "../pack_step";
|
||||
import { TOP_HALF } from "../resource_list";
|
||||
|
||||
describe("packStep()", () => {
|
||||
const plant = resourceUpdate({ resource_type: "Plant", resource_id: 6 });
|
||||
|
||||
it("serializes 'discard' actions", () => {
|
||||
const actionDDI = { value: "removed", label: "Removed" };
|
||||
const { args } = packStep(plant, undefined, actionDDI);
|
||||
expect(args.label).toEqual("discarded_at");
|
||||
expect(args.value).toEqual("{{ Time.now }}");
|
||||
expect(args.resource_id).toEqual(6);
|
||||
expect(args.resource_type).toEqual("Plant");
|
||||
});
|
||||
|
||||
it("serializes 'plant_stage' actions", () => {
|
||||
const actionDDI = { value: "harvested", label: "harvested" };
|
||||
const { args } = packStep(plant, undefined, actionDDI);
|
||||
expect(args.label).toEqual("plant_stage");
|
||||
expect(args.value).toEqual("harvested");
|
||||
expect(args.resource_id).toEqual(6);
|
||||
expect(args.resource_type).toEqual("Plant");
|
||||
});
|
||||
|
||||
it("serializes 'mounted_tool_id' actions", () => {
|
||||
const resourceDDI = TOP_HALF[0];
|
||||
const actionDDI = { value: 23, label: "Mounted to can opener" };
|
||||
const device = resourceUpdate({ resource_type: "Device", resource_id: 7 });
|
||||
const { args } = packStep(device, resourceDDI, actionDDI);
|
||||
expect(args.label).toEqual("mounted_tool_id");
|
||||
expect(args.resource_type).toEqual("Device");
|
||||
expect(args.resource_id).toEqual(0);
|
||||
expect(args.value).toEqual(23);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
describe("resourceList()", () => {
|
||||
it("lists defaults, plus saved points", () => {
|
||||
expect(2 + 2).toBe(4);
|
||||
// fail("BRB");
|
||||
});
|
||||
});
|
|
@ -4,7 +4,8 @@ import { selectAllPoints } from "../../../resources/selectors";
|
|||
import { TaggedResource, TaggedPoint } from "farmbot";
|
||||
|
||||
const value = 0; // Not used in headings.
|
||||
const TOP_HALF = [
|
||||
|
||||
export const TOP_HALF = [
|
||||
{ headingId: "Device", label: "Device", value, heading: true, },
|
||||
{ headingId: "Device", label: "Tool Mount", value },
|
||||
{ headingId: "Plant", label: "Plants", value, heading: true, }
|
||||
|
|
|
@ -61,6 +61,8 @@ export function fakeResourceIndex(): ResourceIndex {
|
|||
"meta": {},
|
||||
"name": "dandelion",
|
||||
"pointer_type": "Plant",
|
||||
"openfarm_slug": "potato",
|
||||
"plant_stage": "harvested",
|
||||
"radius": 100,
|
||||
"x": 100,
|
||||
"y": 200,
|
||||
|
|
Loading…
Reference in New Issue