Repository: freeCodeCamp/freeCodeCamp
File: api/src/exam-environment/utils/exam-environment.test.ts (TypeScript)

Code before:
          id: oid(),
          tags: [''],
          text: ''
        }
      ];
      const questionSets = [
        {
          context: '',
          id: oid(),
          questions,
          type: ExamEnvironmentQuestionType.MultipleChoice
        }
      ];
      const data = {
        config,
        deprecated: false,
        prerequisites: [oid()],
        questionSets
      };

      expect(async () => {
        await fastifyTestInstance.prisma.examEnvironmentExam.create({
          data
        });
      }).not.toThrow();
    });
  });
  describe('ExamEnvironmentGeneratedExam', () => {
    afterAll(async () => {
      await fastifyTestInstance.prisma.examEnvironmentGeneratedExam.deleteMany(
        {}
      );
    });
    it('should throw if the schema changes, and remind to increment the `version` field by 1', () => {
      expect(async () => {
        await fastifyTestInstance.prisma.examEnvironmentGeneratedExam.create({
          data: {
            deprecated: false,
            examId: oid(),
            questionSets: [
              { id: oid(), questions: [{ answers: [oid()], id: oid() }] }
            ]
          }
        });
      }).not.toThrow();
    });
  });
  describe('ExamEnvironmentExamAttempt', () => {
    afterAll(async () => {
      await fastifyTestInstance.prisma.examEnvironmentExamAttempt.deleteMany(
        {}

Review comment (bug):
```suggestion
      await fastifyTestInstance.prisma.examEnvironmentExam.create({
        data
      });
```
This fails the suite rather than this specific test as the promise isn't awaited. If you're only interested in knowing if it throws or not, you can just `await` like this.

Code after:
          id: oid(),
          tags: [''],
          text: ''
        }
      ];
      const questionSets = [
        {
          context: '',
          id: oid(),
          questions,
          type: ExamEnvironmentQuestionType.MultipleChoice
        }
      ];
      const data = {
        config,
        deprecated: false,
        prerequisites: [oid()],
        questionSets
      };

      await fastifyTestInstance.prisma.examEnvironmentExam.create({
        data
      });
    });
  });
  describe('ExamEnvironmentGeneratedExam', () => {
    afterAll(async () => {
      await fastifyTestInstance.prisma.examEnvironmentGeneratedExam.deleteMany(
        {}
      );
    });
    it("If this test fails and you've deliberately altered the schema, then increment the `version` field by 1", async () => {
      await fastifyTestInstance.prisma.examEnvironmentGeneratedExam.create({
        data: {
          deprecated: false,
          examId: oid(),
          questionSets: [
            { id: oid(), questions: [{ answers: [oid()], id: oid() }] }
          ]
        }
      });
    });
  });
  describe('ExamEnvironmentExamAttempt', () => {
    afterAll(async () => {
      await fastifyTestInstance.prisma.examEnvironmentExamAttempt.deleteMany(
        {}
      );
    });
    it("If this test fails and you've deliberately altered the schema, then increment the `version` field by 1", async () => {
      await fastifyTestInstance.prisma.examEnvironmentExamAttempt.create({