//
// SPDX-License-Identifier: AGPL-3.0
-import projectsReducer, { getTreePath } from "./project-reducer";
-import actions from "./project-action";
+import { projectsReducer, getTreePath } from "./project-reducer";
+import { projectActions } from "./project-action";
import { TreeItem, TreeItemStatus } from "../../components/tree/tree";
import { mockProjectResource } from "../../models/test-utils";
const initialState = undefined;
const projects = [mockProjectResource({ uuid: "1" }), mockProjectResource({ uuid: "2" })];
- const state = projectsReducer(initialState, actions.PROJECTS_SUCCESS({ projects, parentItemId: undefined }));
+ const state = projectsReducer(initialState, projectActions.PROJECTS_SUCCESS({ projects, parentItemId: undefined }));
expect(state).toEqual({
items: [{
active: false,
id: "2",
items: [],
data: mockProjectResource({ uuid: "2" }),
- status: 0
+ status: TreeItemStatus.INITIAL
}
],
currentItemId: "",
id: "1",
open: true,
active: true,
- status: 1
+ status: TreeItemStatus.PENDING
}],
currentItemId: "1",
creator: { opened: false, pending: false, ownerUuid: "" },
id: "1",
open: true,
active: false,
- status: 1
+ status: TreeItemStatus.PENDING
}],
currentItemId: "",
creator: { opened: false, pending: false, ownerUuid: "" },
};
- const state = projectsReducer(initialState, actions.RESET_PROJECT_TREE_ACTIVITY(initialState.items[0].id));
+ const state = projectsReducer(initialState, projectActions.RESET_PROJECT_TREE_ACTIVITY(initialState.items[0].id));
expect(state).toEqual(project);
});
id: "1",
open: true,
active: false,
- status: 1
+ status: TreeItemStatus.PENDING
}],
currentItemId: "1",
creator: { opened: false, pending: false, ownerUuid: "" }
id: "1",
open: true,
active: true,
- status: 1,
- toggled: true
+ status: TreeItemStatus.PENDING,
}],
currentItemId: "1",
creator: { opened: false, pending: false, ownerUuid: "" },
};
- const state = projectsReducer(initialState, actions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(initialState.items[0].id));
+ const state = projectsReducer(initialState, projectActions.TOGGLE_PROJECT_TREE_ITEM_ACTIVE(initialState.items[0].id));
expect(state).toEqual(project);
});
id: "1",
open: true,
active: false,
- status: 1,
- toggled: false,
+ status: TreeItemStatus.PENDING,
}],
currentItemId: "1",
creator: { opened: false, pending: false, ownerUuid: "" }
id: "1",
open: false,
active: false,
- status: 1,
- toggled: true
+ status: TreeItemStatus.PENDING,
}],
currentItemId: "1",
creator: { opened: false, pending: false, ownerUuid: "" },
};
- const state = projectsReducer(initialState, actions.TOGGLE_PROJECT_TREE_ITEM_OPEN(initialState.items[0].id));
+ const state = projectsReducer(initialState, projectActions.TOGGLE_PROJECT_TREE_ITEM_OPEN(initialState.items[0].id));
expect(state).toEqual(project);
});
});
active: false,
data: "",
open: false,
- status: TreeItemStatus.Initial
+ status: TreeItemStatus.INITIAL
});
it("should return an array that matches path to the given item", () => {