[STABLE] Done removing arrays
parent
2cd0d43c4a
commit
11e922ae2d
|
@ -23,7 +23,7 @@ test("buildResourceIndex - base case", () => {
|
|||
const result1 = buildResourceIndex(FAKE_RESOURCES);
|
||||
const { index } = result1;
|
||||
const OK_LENGTH = FAKE_RESOURCES.length;
|
||||
expect(index.all.length).toBe(OK_LENGTH);
|
||||
expect(Object.keys(index.all).length).toBe(OK_LENGTH);
|
||||
expect(Object.keys(index.references).length).toBe(OK_LENGTH);
|
||||
});
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ describe("updateViaAjax()", () => {
|
|||
dispatch: jest.fn(),
|
||||
index: buildResourceIndex([fakePeripheral()]).index
|
||||
};
|
||||
payload.uuid = payload.index.all[0];
|
||||
payload.uuid = Object.keys(payload.index.all)[0];
|
||||
updateViaAjax(payload).catch(e => {
|
||||
expect("" + e).toEqual("Error: Just saved a malformed TR.");
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ describe("mapStateToProps()", () => {
|
|||
const plant = fakePlant();
|
||||
plant.body.id = 10;
|
||||
state.resources = buildResourceIndex([plant]);
|
||||
const uuid = state.resources.index.all[0];
|
||||
const uuid = Object.keys(state.resources.index.all)[0];
|
||||
const result = mapStateToProps(state);
|
||||
expect(result.findPlant(undefined)).toEqual(undefined);
|
||||
expect(result.findPlant("10")).toEqual(
|
||||
|
|
|
@ -23,7 +23,7 @@ describe("unsavedCheck", () => {
|
|||
const output = fakeState();
|
||||
output.resources = buildResourceIndex([config]);
|
||||
// `buildResourceIndex` clears specialStatus. Set it again:
|
||||
const uuid = output.resources.index.all[0];
|
||||
const uuid = Object.keys(output.resources.index.all)[0];
|
||||
// tslint:disable-next-line:no-any
|
||||
(output.resources.index.references[uuid] || {} as any)
|
||||
.specialStatus = specialStatus;
|
||||
|
|
|
@ -34,7 +34,7 @@ describe("mapStateToProps()", () => {
|
|||
})
|
||||
];
|
||||
state.resources.index = buildResourceIndex(fakeResources).index;
|
||||
const regimenUuid = state.resources.index.all[0];
|
||||
const regimenUuid = Object.keys(state.resources.index.all)[0];
|
||||
state.resources.consumers.regimens.currentRegimen = regimenUuid;
|
||||
const props = mapStateToProps(state);
|
||||
props.current ? expect(props.current.uuid).toEqual(regimenUuid) : fail;
|
||||
|
|
|
@ -41,8 +41,9 @@ describe("commitBulkEditor()", () => {
|
|||
}))
|
||||
];
|
||||
state.resources.index = buildResourceIndex(fakeResources).index;
|
||||
const regimenUuid = state.resources.index.all[0];
|
||||
const sequenceUuid = state.resources.index.all[1];
|
||||
const all = Object.keys(state.resources.index.all);
|
||||
const regimenUuid = all[0];
|
||||
const sequenceUuid = all[1];
|
||||
|
||||
state.resources.consumers.regimens.currentRegimen = regimenUuid;
|
||||
state.resources.consumers.regimens.selectedSequenceUUID = sequenceUuid;
|
||||
|
|
|
@ -200,7 +200,7 @@ describe("Pin and Peripheral support files", () => {
|
|||
it("converts peripherals to DropDownItems", () => {
|
||||
const p = fakePeripheral();
|
||||
const ri = buildResourceIndex([p]).index;
|
||||
const uuid = ri.all[0];
|
||||
const uuid = Object.keys(ri.all)[0];
|
||||
const pin_type: AllowedPinTypes = "Peripheral";
|
||||
const pin_id = p.body.id || 0;
|
||||
const np: NamedPin = { kind: "named_pin", args: { pin_id, pin_type } };
|
||||
|
@ -312,7 +312,7 @@ describe("Pin and Peripheral support files", () => {
|
|||
const s = fakeSensor();
|
||||
s.body.id = 1;
|
||||
const ri = buildResourceIndex([s]);
|
||||
const uuid = ri.index.all[0];
|
||||
const uuid = Object.keys(ri.index.all)[0];
|
||||
const result = celery2DropDown({
|
||||
kind: "named_pin",
|
||||
args: { pin_type: "Sensor", pin_id: 1 }
|
||||
|
|
Loading…
Reference in New Issue