11import { Static } from '@fastify/type-provider-typebox' ;
22import {
3- EnvConfig ,
4- EnvQuestionType ,
5- EnvExamAttempt ,
6- EnvExam ,
7- EnvGeneratedExam ,
8- EnvQuestionSet
3+ ExamEnvironmentConfig ,
4+ ExamEnvironmentQuestionType ,
5+ ExamEnvironmentExamAttempt ,
6+ ExamEnvironmentExam ,
7+ ExamEnvironmentGeneratedExam ,
8+ ExamEnvironmentQuestionSet
99} from '@prisma/client' ;
1010import { ObjectId } from 'mongodb' ;
1111// import { defaultUserId } from '../jest.utils';
@@ -18,28 +18,29 @@ const defaultUserId = '64c7810107dd4782d32baee7';
1818
1919export const examId = oid ( ) ;
2020
21- export const config : EnvConfig = {
21+ export const config : ExamEnvironmentConfig = {
2222 totalTimeInMS : 2 * 60 * 60 * 1000 ,
2323 tags : [ ] ,
2424 name : 'Test Exam' ,
2525 note : 'Some exam note...' ,
26+ passingPercent : 80 ,
2627 questionSets : [
2728 {
28- type : EnvQuestionType . MultipleChoice ,
29+ type : ExamEnvironmentQuestionType . MultipleChoice ,
2930 numberOfSet : 1 ,
3031 numberOfQuestions : 1 ,
3132 numberOfCorrectAnswers : 1 ,
3233 numberOfIncorrectAnswers : 1
3334 } ,
3435 {
35- type : EnvQuestionType . MultipleChoice ,
36+ type : ExamEnvironmentQuestionType . MultipleChoice ,
3637 numberOfSet : 1 ,
3738 numberOfQuestions : 1 ,
3839 numberOfCorrectAnswers : 2 ,
3940 numberOfIncorrectAnswers : 1
4041 } ,
4142 {
42- type : EnvQuestionType . Dialogue ,
43+ type : ExamEnvironmentQuestionType . Dialogue ,
4344 numberOfSet : 1 ,
4445 numberOfQuestions : 2 ,
4546 numberOfCorrectAnswers : 1 ,
@@ -49,10 +50,10 @@ export const config: EnvConfig = {
4950 retakeTimeInMS : 24 * 60 * 60 * 1000
5051} ;
5152
52- export const questionSets : EnvQuestionSet [ ] = [
53+ export const questionSets : ExamEnvironmentQuestionSet [ ] = [
5354 {
5455 id : oid ( ) ,
55- type : EnvQuestionType . MultipleChoice ,
56+ type : ExamEnvironmentQuestionType . MultipleChoice ,
5657 context : null ,
5758 questions : [
5859 {
@@ -83,7 +84,7 @@ export const questionSets: EnvQuestionSet[] = [
8384 } ,
8485 {
8586 id : oid ( ) ,
86- type : EnvQuestionType . MultipleChoice ,
87+ type : ExamEnvironmentQuestionType . MultipleChoice ,
8788 context : null ,
8889 questions : [
8990 {
@@ -114,7 +115,7 @@ export const questionSets: EnvQuestionSet[] = [
114115 } ,
115116 {
116117 id : oid ( ) ,
117- type : EnvQuestionType . Dialogue ,
118+ type : ExamEnvironmentQuestionType . Dialogue ,
118119 context : 'Dialogue 1 context' ,
119120 questions : [
120121 {
@@ -196,7 +197,7 @@ export const questionSets: EnvQuestionSet[] = [
196197 }
197198] ;
198199
199- export const generatedExam : EnvGeneratedExam = {
200+ export const generatedExam : ExamEnvironmentGeneratedExam = {
200201 examId,
201202 id : oid ( ) ,
202203 deprecated : false ,
@@ -250,11 +251,10 @@ export const generatedExam: EnvGeneratedExam = {
250251 ]
251252} ;
252253
253- export const examAttempt : EnvExamAttempt = {
254+ export const examAttempt : ExamEnvironmentExamAttempt = {
254255 examId,
255256 generatedExamId : generatedExam . id ,
256257 id : oid ( ) ,
257- needsRetake : false ,
258258 questionSets : [
259259 {
260260 id : generatedExam . questionSets [ 0 ] ! . id ,
@@ -335,7 +335,7 @@ export const examAttemptSansSubmissionTimeInMS: Static<
335335 ]
336336} ;
337337
338- export const exam : EnvExam = {
338+ export const exam : ExamEnvironmentExam = {
339339 id : examId ,
340340 config,
341341 questionSets,
@@ -346,10 +346,10 @@ export const exam: EnvExam = {
346346export async function seedEnvExam ( ) {
347347 await clearEnvExam ( ) ;
348348
349- await fastifyTestInstance . prisma . envExam . create ( {
349+ await fastifyTestInstance . prisma . examEnvironmentExam . create ( {
350350 data : exam
351351 } ) ;
352- await fastifyTestInstance . prisma . envGeneratedExam . create ( {
352+ await fastifyTestInstance . prisma . examEnvironmentGeneratedExam . create ( {
353353 data : generatedExam
354354 } ) ;
355355
@@ -359,7 +359,7 @@ export async function seedEnvExam() {
359359 // while (numberOfExamsGenerated < 2) {
360360 // try {
361361 // const generatedExam = generateExam(exam);
362- // await fastifyTestInstance.prisma.envGeneratedExam .create({
362+ // await fastifyTestInstance.prisma.examEnvironmentGeneratedExam .create({
363363 // data: generatedExam
364364 // });
365365 // numberOfExamsGenerated++;
@@ -370,13 +370,13 @@ export async function seedEnvExam() {
370370}
371371
372372export async function clearEnvExam ( ) {
373- await fastifyTestInstance . prisma . envExamAttempt . deleteMany ( { } ) ;
374- await fastifyTestInstance . prisma . envGeneratedExam . deleteMany ( { } ) ;
375- await fastifyTestInstance . prisma . envExam . deleteMany ( { } ) ;
373+ await fastifyTestInstance . prisma . examEnvironmentExamAttempt . deleteMany ( { } ) ;
374+ await fastifyTestInstance . prisma . examEnvironmentGeneratedExam . deleteMany ( { } ) ;
375+ await fastifyTestInstance . prisma . examEnvironmentExam . deleteMany ( { } ) ;
376376}
377377
378378export async function seedEnvExamAttempt ( ) {
379- await fastifyTestInstance . prisma . envExamAttempt . create ( {
379+ await fastifyTestInstance . prisma . examEnvironmentExamAttempt . create ( {
380380 data : examAttempt
381381 } ) ;
382382}
0 commit comments