@@ -5,13 +5,16 @@ import facultyEducationModel from "#models/employee/empEduHistory";
55import facultyPersonalModel from "#models/employee/empPersonal" ;
66import facultyBankModel from "#models/employee/empBank" ;
77import facultyCurrentModel from "#models/employee/empCurrentDetail" ;
8+ import courseModel from "#models/course" ;
9+ import departmentModel from "#models/department" ;
810
911jest . mock ( "#util" ) ;
1012const { agent } = global ;
13+ let departmentId ;
14+ let courseId ;
1115
1216// test case for deletion
1317function cleanUp ( callback ) {
14-
1518 facultyBankModel . remove ( { uid : "aaaaa" } ) ;
1619 facultyCurrentModel . remove ( { uid : "aaaaa" } ) ;
1720 facultyEducationModel . remove ( { uid : "aaaaa" } ) ;
@@ -28,8 +31,8 @@ function cleanUp(callback) {
2831 areaOfSpecialization : [ "Specialization 1" , "Specialization 2" ] ,
2932 papersPublishedPG : 10 ,
3033 papersPublishedUG : 5 ,
31- department : [ "5f7b75a5c69e2d4f0c285e52" ] ,
32- preferredSubjects : [ "5f7b75a5c69e2d4f0c285e53" ] ,
34+ department : [ departmentId ] ,
35+ preferredSubjects : [ courseId ] ,
3336 designation : "Assistant Professor" ,
3437 natureOfAssociation : "Regular" ,
3538 additionalResponsibilities : "Teaching and Research" ,
@@ -42,6 +45,19 @@ function cleanUp(callback) {
4245 } ) ;
4346}
4447
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+
4561afterAll ( ( done ) => {
4662 cleanUp ( done ) ;
4763} ) ;
@@ -58,8 +74,8 @@ describe("Faculty API", () => {
5874 areaOfSpecialization : [ "Specialization 1" , "Specialization 2" ] ,
5975 papersPublishedPG : 10 ,
6076 papersPublishedUG : 5 ,
61- department : [ "5f7b75a5c69e2d4f0c285e52" ] ,
62- preferredSubjects : [ "5f7b75a5c69e2d4f0c285e53" ] ,
77+ department : [ departmentId ] ,
78+ preferredSubjects : [ courseId ] ,
6379 designation : "Assistant Professor" ,
6480 natureOfAssociation : "Regular" ,
6581 additionalResponsibilities : "Teaching and Research" ,
@@ -292,8 +308,8 @@ describe("Faculty API", () => {
292308 areaOfSpecialization : [ "Specialization 1" , "Specialization 2" ] ,
293309 papersPublishedPG : 10 ,
294310 papersPublishedUG : 5 ,
295- department : [ "5f7b75a5c69e2d4f0c285e52" ] ,
296- preferredSubjects : [ "5f7b75a5c69e2d4f0c285e53" ] ,
311+ department : [ departmentId ] ,
312+ preferredSubjects : [ courseId ] ,
297313 designation : "Assistant Professor" ,
298314 natureOfAssociation : "Regular" ,
299315 additionalResponsibilities : "Teaching and Research" ,
@@ -521,8 +537,8 @@ describe("Faculty API", () => {
521537 areaOfSpecialization : [ "Specialization 1" , "Specialization 2" ] ,
522538 papersPublishedPG : 10 ,
523539 papersPublishedUG : 5 ,
524- department : [ "5f7b75a5c69e2d4f0c285e52" ] ,
525- preferredSubjects : [ "5f7b75a5c69e2d4f0c285e53" ] ,
540+ department : [ departmentId ] ,
541+ preferredSubjects : [ courseId ] ,
526542 designation : "Assistant Professor" ,
527543 natureOfAssociation : "Regular" ,
528544 additionalResponsibilities : "Teaching and Research" ,
0 commit comments