Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { resolveAssignment, TaskServiceError } from "./taskService.server";
|
||||
|
||||
/**
|
||||
* Single-assignee rule (AK-P4b DoD 2): a task is assigned to exactly one of a
|
||||
* user or a group; default = creator. Pure logic, no DB.
|
||||
*/
|
||||
describe("resolveAssignment", () => {
|
||||
it("defaults to the creator when neither user nor group is given", () => {
|
||||
expect(resolveAssignment({ creatorUserId: "u-creator" })).toEqual({
|
||||
assignedToUserId: "u-creator",
|
||||
assignedToGroupId: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps a single user assignment", () => {
|
||||
expect(resolveAssignment({ creatorUserId: "u-creator", assignedToUserId: "u-1" })).toEqual({
|
||||
assignedToUserId: "u-1",
|
||||
assignedToGroupId: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps a single group assignment", () => {
|
||||
expect(resolveAssignment({ creatorUserId: "u-creator", assignedToGroupId: "g-1" })).toEqual({
|
||||
assignedToUserId: null,
|
||||
assignedToGroupId: "g-1",
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects assigning to both a user and a group", () => {
|
||||
expect(() => resolveAssignment({ creatorUserId: "u-creator", assignedToUserId: "u-1", assignedToGroupId: "g-1" })).toThrow(TaskServiceError);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user