Skip to content

Some tests are not passing  #49

@omiras

Description

@omiras

Test Results Analysis

Some tests are not passing. For some, I have clear explanations, while for others, I can only make assumptions:

image

Our Mongoose model does include the explanation and status fields. However, when we insert documents directly using db.questions.insertMany with files generated in utils/output, these fields might not always be handled correctly.

Some other failing tests are related to the AI Gemini endpoint. I suspect the issue could be due to rate limitations imposed by AI Gemini or perhaps conflicts with helmet or express-rate-limit middleware.


Steps to Reproduce the Issue

  1. Set all .env variables and configure the database to /codequest-production.
  2. Start the server.
  3. In another terminal, run npm test.

Expected Results

All tests should pass successfully.


Current Results

Three tests are failing.


Suggested Actions

  1. Adjust Field Requirements
    We could make the explanation and status fields optional in the tests to prevent strict validation errors.
    Alternatively, we could automate the insertion of documents using Question.create() from JSON files generated by markdown2Json, but this might take longer to implement.

  2. Investigate AI Test Timeouts
    Debug the timeout issue with AI-related tests, potentially adjusting rate-limiting configurations or exploring other middleware conflicts.


Future Work

These tests are classified as integration tests because they directly test the endpoints. In the future, we could introduce unit tests using libraries like supertest to mock responses. This is an advanced topic that could be of interest to anyone eager to learn more about Q&A systems and testing methodologies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions