@@ -11,6 +11,7 @@ import { UsersModule } from '../users/users.module';
11
11
import { CreateQueueDto } from './dto/create-queue.dto' ;
12
12
import { ConflictException , ForbiddenException , NotFoundException } from '@nestjs/common' ;
13
13
import { Request } from 'express' ;
14
+ import { Queue } from '@prisma/client' ;
14
15
15
16
describe ( 'QueuesService' , ( ) => {
16
17
let prismaService : PrismaService ;
@@ -87,6 +88,29 @@ describe('QueuesService', () => {
87
88
} ) ;
88
89
} ) ;
89
90
91
+ describe ( 'findAllQueuesByLabId' , ( ) => {
92
+ it ( 'should return an array of queues' , async ( ) => {
93
+ const labId = 'test-lab-id' ;
94
+ const user = await prismaService . user . create ( {
95
+ data : {
96
+
97
+ password : '123456' ,
98
+ firstName : 'John' ,
99
+ lastName : 'Doe' ,
100
+ admin : false ,
101
+ approved : true ,
102
+ } ,
103
+ } ) ;
104
+
105
+ const queueDto : CreateQueueDto = { labId } ;
106
+ const queue1 = await queuesService . createQueue ( queueDto , user . id ) ;
107
+ const queue2 = await queuesService . createQueue ( queueDto , user . id ) ;
108
+
109
+ const result = await queuesService . findAllQueuesByLabId ( labId ) ;
110
+ expect ( result ) . toEqual ( [ queue1 , queue2 ] ) ;
111
+ } ) ;
112
+ } ) ;
113
+
90
114
describe ( 'deleteQueueById' , ( ) => {
91
115
it ( 'should allow admin to delete a queue' , async ( ) => {
92
116
const admin = await prismaService . user . create ( {
0 commit comments