@@ -53,7 +53,6 @@ describe("fromTimeslotNode", () => {
5353 capacity : 5 ,
5454 category : "guide" ,
5555 quantity : 1 ,
56- status : "ACTIVE" ,
5756 accountUserId : "u1" ,
5857 } ,
5958 ] ,
@@ -90,7 +89,7 @@ describe("fromTimeslotNode", () => {
9089 minuteLength : null ,
9190 status : null ,
9291 date : null ,
93- inheritedResourceAllocations : [ { quantity : null , status : null , resourcePool : null } ] ,
92+ inheritedResourceAllocations : [ { quantity : null , status : "ACTIVE" , resourcePool : null } ] ,
9493 } as unknown as TimeslotNode ;
9594
9695 expect ( fromTimeslotNode ( node , "act-1" ) ) . toEqual ( {
@@ -107,7 +106,7 @@ describe("fromTimeslotNode", () => {
107106 date : "" ,
108107 startTime : null ,
109108 assignedResources : [
110- { name : "" , capacity : 0 , category : "" , quantity : 0 , status : "" , accountUserId : null } ,
109+ { name : "" , capacity : 0 , category : "" , quantity : 0 , accountUserId : null } ,
111110 ] ,
112111 } ) ;
113112 } ) ;
@@ -116,6 +115,23 @@ describe("fromTimeslotNode", () => {
116115 const node = { ...fullNode , inheritedResourceAllocations : null } as unknown as TimeslotNode ;
117116 expect ( fromTimeslotNode ( node , "act-1" ) . assignedResources ) . toEqual ( [ ] ) ;
118117 } ) ;
118+
119+ it ( "filters out allocations whose status is not ACTIVE" , ( ) => {
120+ const node = {
121+ ...fullNode ,
122+ inheritedResourceAllocations : [
123+ ...( fullNode . inheritedResourceAllocations ?? [ ] ) ,
124+ {
125+ quantity : 1 ,
126+ status : "REMOVAL" ,
127+ resourcePool : { name : "Bob" , category : "guide" , capacity : 5 , accountUser : { id : "u2" } } ,
128+ } ,
129+ ] ,
130+ } as unknown as TimeslotNode ;
131+ const { assignedResources } = fromTimeslotNode ( node , "act-1" ) ;
132+ expect ( assignedResources ) . toHaveLength ( 1 ) ;
133+ expect ( assignedResources [ 0 ] . name ) . toBe ( "Ada" ) ;
134+ } ) ;
119135} ) ;
120136
121137describe ( "fromTimeslotNodes" , ( ) => {
0 commit comments