@@ -106,7 +106,7 @@ describe("getVolunteersByMultipleColumns (integration)", () => {
106106 let volunteer1Id : number ; // Role 1, Cohort 1
107107 let volunteer2Id : number ; // Role 2, Cohort 1, Cohort 2
108108 let volunteer3Id : number ; // Role 1, Role 2, Cohort 2
109- let role1Id : number , role2Id : number ;
109+ let role1Id : number , role2Id : number , role3Id : number , role4Id : number ;
110110 let cohort1Id : number , cohort2Id : number ;
111111
112112 beforeAll ( async ( ) => {
@@ -138,6 +138,8 @@ describe("getVolunteersByMultipleColumns (integration)", () => {
138138 . insert ( [
139139 makeTestRoleInsert ( { name : "TEST_Role1" } ) ,
140140 makeTestRoleInsert ( { name : "TEST_Role2" } ) ,
141+ makeTestRoleInsert ( { name : "TEST_Role3" , type : "prior" } ) ,
142+ makeTestRoleInsert ( { name : "TEST_Role4" , type : "future_interest" } ) ,
141143 ] )
142144 . select ( ) ;
143145
@@ -158,9 +160,11 @@ describe("getVolunteersByMultipleColumns (integration)", () => {
158160 volunteer2Id = v2 ! . id ;
159161 volunteer3Id = v3 ! . id ;
160162
161- const [ r1 , r2 ] = r ! ;
163+ const [ r1 , r2 , r3 , r4 ] = r ! ;
162164 role1Id = r1 ! . id ;
163165 role2Id = r2 ! . id ;
166+ role3Id = r3 ! . id ;
167+ role4Id = r4 ! . id ;
164168
165169 const [ c1 , c2 ] = c ! ;
166170 cohort1Id = c1 ! . id ;
@@ -170,9 +174,13 @@ describe("getVolunteersByMultipleColumns (integration)", () => {
170174 . from ( "VolunteerRoles" )
171175 . insert ( [
172176 makeTestVolunteerRoleInsert ( volunteer1Id , role1Id ) ,
177+ makeTestVolunteerRoleInsert ( volunteer1Id , role3Id ) ,
173178 makeTestVolunteerRoleInsert ( volunteer3Id , role1Id ) ,
179+ makeTestVolunteerRoleInsert ( volunteer2Id , role4Id ) ,
174180 makeTestVolunteerRoleInsert ( volunteer2Id , role2Id ) ,
175181 makeTestVolunteerRoleInsert ( volunteer3Id , role2Id ) ,
182+ makeTestVolunteerRoleInsert ( volunteer3Id , role3Id ) ,
183+ makeTestVolunteerRoleInsert ( volunteer3Id , role4Id ) ,
176184 ] ) ;
177185
178186 const { error : vcError } = await client
@@ -228,6 +236,30 @@ describe("getVolunteersByMultipleColumns (integration)", () => {
228236 expect ( ids ) . not . toContain ( volunteer2Id ) ;
229237 } ) ;
230238
239+ it ( "filters by prior_roles" , async ( ) => {
240+ const filters : FilterTuple [ ] = [
241+ { field : "prior_roles" , miniOp : "OR" , values : [ "TEST_Role3" ] } ,
242+ ] ;
243+ const { data } = await getVolunteersByMultipleColumns ( filters , "AND" ) ;
244+ const ids = data ;
245+
246+ expect ( ids ) . toContain ( volunteer1Id ) ;
247+ expect ( ids ) . toContain ( volunteer3Id ) ;
248+ expect ( ids ) . not . toContain ( volunteer2Id ) ;
249+ } ) ;
250+
251+ it ( "filters by future_interests" , async ( ) => {
252+ const filters : FilterTuple [ ] = [
253+ { field : "future_interests" , miniOp : "OR" , values : [ "TEST_Role4" ] } ,
254+ ] ;
255+ const { data } = await getVolunteersByMultipleColumns ( filters , "AND" ) ;
256+ const ids = data ;
257+
258+ expect ( ids ) . toContain ( volunteer2Id ) ;
259+ expect ( ids ) . toContain ( volunteer3Id ) ;
260+ expect ( ids ) . not . toContain ( volunteer1Id ) ;
261+ } ) ;
262+
231263 it ( "cohorts by cohort with OR" , async ( ) => {
232264 const filters : FilterTuple [ ] = [
233265 { field : "cohorts" , miniOp : "OR" , values : [ [ "Fall" , String ( TEST_YEAR ) ] ] } ,
0 commit comments