Skip to content

Commit

Permalink
fix planning action utils & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkLark86 committed Dec 3, 2024
1 parent 607af65 commit 5fc066a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/utils/planning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function canEditPlanning(
(
primaryEvents.length === 0
|| isCancelPlanWithEventDisabled()
|| primaryEvents.some((event) => (
|| !primaryEvents.some((event) => (
getItemWorkflowState(event) === WORKFLOW_STATE.KILLED
|| isItemSpiked(event)
))
Expand Down
28 changes: 16 additions & 12 deletions client/utils/tests/planning_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ describe('PlanningUtils', () => {

const itemActions = planningUtils.getPlanningActions({
item: planning,
events: [event],
events: [],
session: session,
privileges: privileges,
lockedItems: locks,
Expand All @@ -683,7 +683,7 @@ describe('PlanningUtils', () => {

let itemActions = planningUtils.getPlanningActions({
item: planning,
events: [event],
events: [],
session: session,
privileges: privileges,
lockedItems: locks,
Expand All @@ -694,13 +694,14 @@ describe('PlanningUtils', () => {
expectActions(itemActions, ['Duplicate', 'Edit']);

planning.related_events = [{
_id: '1',
_id: 'event1',
link_type: 'primary',
}];

event = {
_id: 'event1',
state: 'cancelled',
planning_ids: ['1'],
planning_ids: ['plan1'],
};

itemActions = planningUtils.getPlanningActions({
Expand All @@ -721,7 +722,7 @@ describe('PlanningUtils', () => {

let itemActions = planningUtils.getPlanningActions({
item: planning,
events: [event],
events: [],
session: session,
privileges: privileges,
lockedItems: locks,
Expand All @@ -734,13 +735,14 @@ describe('PlanningUtils', () => {
]);

planning.related_events = [{
_id: '1',
_id: 'event1',
link_type: 'primary',
}];

event = {
_id: 'event1',
state: 'rescheduled',
planning_ids: ['1'],
planning_ids: ['plan1'],
};

itemActions = planningUtils.getPlanningActions({
Expand All @@ -762,13 +764,14 @@ describe('PlanningUtils', () => {
planning.state = 'killed';

planning.related_events = [{
_id: '1',
_id: 'event1',
link_type: 'primary',
}];

event = {
_id: 'event1',
state: 'killed',
planning_ids: ['1'],
planning_ids: ['plan1'],
};

let itemActions = planningUtils.getPlanningActions({
Expand All @@ -790,13 +793,14 @@ describe('PlanningUtils', () => {
planning.state = 'killed';

planning.related_events = [{
_id: '1',
_id: 'event1',
link_type: 'primary',
}];

event = {
_id: 'event1',
state: 'scheduled',
planning_ids: ['1'],
planning_ids: ['plan1'],
};

let itemActions = planningUtils.getPlanningActions({
Expand Down Expand Up @@ -830,7 +834,7 @@ describe('PlanningUtils', () => {

let itemActions = planningUtils.getPlanningActions({
item: planning,
events: [event],
events: [],
session: session,
privileges: privileges,
lockedItems: locks,
Expand Down

0 comments on commit 5fc066a

Please sign in to comment.