@@ -5,13 +5,16 @@ import facultyEducationModel from "#models/employee/empEduHistory";
5
5
import facultyPersonalModel from "#models/employee/empPersonal" ;
6
6
import facultyBankModel from "#models/employee/empBank" ;
7
7
import facultyCurrentModel from "#models/employee/empCurrentDetail" ;
8
+ import courseModel from "#models/course" ;
9
+ import departmentModel from "#models/department" ;
8
10
9
11
jest . mock ( "#util" ) ;
10
12
const { agent } = global ;
13
+ let departmentId ;
14
+ let courseId ;
11
15
12
16
// test case for deletion
13
17
function cleanUp ( callback ) {
14
-
15
18
facultyBankModel . remove ( { uid : "aaaaa" } ) ;
16
19
facultyCurrentModel . remove ( { uid : "aaaaa" } ) ;
17
20
facultyEducationModel . remove ( { uid : "aaaaa" } ) ;
@@ -28,8 +31,8 @@ function cleanUp(callback) {
28
31
areaOfSpecialization : [ "Specialization 1" , "Specialization 2" ] ,
29
32
papersPublishedPG : 10 ,
30
33
papersPublishedUG : 5 ,
31
- department : [ "5f7b75a5c69e2d4f0c285e52" ] ,
32
- preferredSubjects : [ "5f7b75a5c69e2d4f0c285e53" ] ,
34
+ department : [ departmentId ] ,
35
+ preferredSubjects : [ courseId ] ,
33
36
designation : "Assistant Professor" ,
34
37
natureOfAssociation : "Regular" ,
35
38
additionalResponsibilities : "Teaching and Research" ,
@@ -42,6 +45,19 @@ function cleanUp(callback) {
42
45
} ) ;
43
46
}
44
47
48
+ /* eslint-disable no-underscore-dangle */
49
+ async function getIds ( callback ) {
50
+ courseId = await courseModel . read ( { } , 1 ) ;
51
+ courseId = courseId . data [ 0 ] . _id ;
52
+ departmentId = await departmentModel . read ( { } , 1 ) ;
53
+ departmentId = departmentId . data [ 0 ] . _id ;
54
+ callback ( ) ;
55
+ }
56
+
57
+ beforeAll ( ( done ) => {
58
+ getIds ( done ) ;
59
+ } ) ;
60
+
45
61
afterAll ( ( done ) => {
46
62
cleanUp ( done ) ;
47
63
} ) ;
@@ -58,8 +74,8 @@ describe("Faculty API", () => {
58
74
areaOfSpecialization : [ "Specialization 1" , "Specialization 2" ] ,
59
75
papersPublishedPG : 10 ,
60
76
papersPublishedUG : 5 ,
61
- department : [ "5f7b75a5c69e2d4f0c285e52" ] ,
62
- preferredSubjects : [ "5f7b75a5c69e2d4f0c285e53" ] ,
77
+ department : [ departmentId ] ,
78
+ preferredSubjects : [ courseId ] ,
63
79
designation : "Assistant Professor" ,
64
80
natureOfAssociation : "Regular" ,
65
81
additionalResponsibilities : "Teaching and Research" ,
@@ -292,8 +308,8 @@ describe("Faculty API", () => {
292
308
areaOfSpecialization : [ "Specialization 1" , "Specialization 2" ] ,
293
309
papersPublishedPG : 10 ,
294
310
papersPublishedUG : 5 ,
295
- department : [ "5f7b75a5c69e2d4f0c285e52" ] ,
296
- preferredSubjects : [ "5f7b75a5c69e2d4f0c285e53" ] ,
311
+ department : [ departmentId ] ,
312
+ preferredSubjects : [ courseId ] ,
297
313
designation : "Assistant Professor" ,
298
314
natureOfAssociation : "Regular" ,
299
315
additionalResponsibilities : "Teaching and Research" ,
@@ -521,8 +537,8 @@ describe("Faculty API", () => {
521
537
areaOfSpecialization : [ "Specialization 1" , "Specialization 2" ] ,
522
538
papersPublishedPG : 10 ,
523
539
papersPublishedUG : 5 ,
524
- department : [ "5f7b75a5c69e2d4f0c285e52" ] ,
525
- preferredSubjects : [ "5f7b75a5c69e2d4f0c285e53" ] ,
540
+ department : [ departmentId ] ,
541
+ preferredSubjects : [ courseId ] ,
526
542
designation : "Assistant Professor" ,
527
543
natureOfAssociation : "Regular" ,
528
544
additionalResponsibilities : "Teaching and Research" ,
0 commit comments