@@ -160,9 +160,13 @@ describe('DatasetController', () => {
160160 . send ( updatedData )
161161 . expect ( 204 ) ;
162162
163- const dataset = await repo . findById ( dummyDataset . id , {
164- include : [ 'actions' ] ,
165- } ) ;
163+ const dataset = await repo . findById (
164+ dummyDataset . id ,
165+ {
166+ include : [ 'actions' ] ,
167+ } ,
168+ { skipUserFilter : true } ,
169+ ) ;
166170 expect ( dataset ) . to . have . property ( 'votes' , 1 ) ;
167171 expect ( dataset . actions ) . to . be . Array ( ) ;
168172 expect ( dataset . actions ) . to . have . length ( 1 ) ;
@@ -270,7 +274,7 @@ describe('DatasetController', () => {
270274 . send ( updatedData )
271275 . expect ( 400 ) ;
272276 } ) ;
273- it ( 'should should increment votes for different user' , async ( ) => {
277+ it ( 'should increment votes for different user' , async ( ) => {
274278 await client
275279 . patch ( `/datasets/${ dummyDataset . id } ` )
276280 . set (
@@ -288,14 +292,18 @@ describe('DatasetController', () => {
288292 )
289293 . send ( { liked : true } )
290294 . expect ( 204 ) ;
291- const dataset = await repo . findById ( dummyDataset . id , {
292- include : [ 'actions' ] ,
293- } ) ;
295+ const dataset = await repo . findById (
296+ dummyDataset . id ,
297+ {
298+ include : [ 'actions' ] ,
299+ } ,
300+ { skipUserFilter : true } ,
301+ ) ;
294302 expect ( dataset ) . to . have . property ( 'votes' , 2 ) ;
295303 expect ( dataset . actions ) . to . be . Array ( ) ;
296304 expect ( dataset . actions ) . to . have . length ( 2 ) ;
297305 } ) ;
298- it ( 'should should cancel votes for different user ' , async ( ) => {
306+ it ( 'should cancel votes for different users ' , async ( ) => {
299307 await client
300308 . patch ( `/datasets/${ dummyDataset . id } ` )
301309 . set (
@@ -313,14 +321,18 @@ describe('DatasetController', () => {
313321 )
314322 . send ( { liked : false , comment : 'Not good' } )
315323 . expect ( 204 ) ;
316- const dataset = await repo . findById ( dummyDataset . id , {
317- include : [ 'actions' ] ,
318- } ) ;
324+ const dataset = await repo . findById (
325+ dummyDataset . id ,
326+ {
327+ include : [ 'actions' ] ,
328+ } ,
329+ { skipUserFilter : true } ,
330+ ) ;
319331 expect ( dataset ) . to . have . property ( 'votes' , 0 ) ;
320332 expect ( dataset . actions ) . to . be . Array ( ) ;
321333 expect ( dataset . actions ) . to . have . length ( 2 ) ;
322334 } ) ;
323- it ( 'should handle muliple dislikes only ' , async ( ) => {
335+ it ( 'should handle muliple dislikes from different users ' , async ( ) => {
324336 await client
325337 . patch ( `/datasets/${ dummyDataset . id } ` )
326338 . set (
@@ -338,9 +350,13 @@ describe('DatasetController', () => {
338350 )
339351 . send ( { liked : false , comment : 'Not good' } )
340352 . expect ( 204 ) ;
341- const dataset = await repo . findById ( dummyDataset . id , {
342- include : [ 'actions' ] ,
343- } ) ;
353+ const dataset = await repo . findById (
354+ dummyDataset . id ,
355+ {
356+ include : [ 'actions' ] ,
357+ } ,
358+ { skipUserFilter : true } ,
359+ ) ;
344360 expect ( dataset ) . to . have . property ( 'votes' , - 2 ) ;
345361 expect ( dataset . actions ) . to . be . Array ( ) ;
346362 expect ( dataset . actions ) . to . have . length ( 2 ) ;
@@ -396,7 +412,7 @@ describe('DatasetController', () => {
396412 const ctx = new Context ( appInstance ) ;
397413 ctx . bind ( AuthenticationBindings . CURRENT_USER ) . to ( {
398414 id : 'test-user' ,
399- userTenantId : 'default' ,
415+ userTenantId : 'default-user-id ' ,
400416 } as unknown as IAuthUserWithPermissions ) ;
401417 const dsrepo = await ctx . get < DataSetRepository > (
402418 `repositories.${ DataSetRepository . name } ` ,
0 commit comments