ansopedia / user-service

The Ansopedia User Service is a backend service responsible for managing user accounts and authentication within the Ansopedia learning platform. It provides functionalities like authentication & authorization, profile management.
4 stars 1 forks source link

FE - Setup Database Connection and Test Server for User Service #2

Closed ansopedia closed 6 months ago

ansopedia commented 6 months ago

Description:

This issue focuses on establishing the database connection and test environment for the Ansopedia user service.

Folder Structure

src
  db
    connection.ts
    config.ts

Sub-tasks:

  1. Database Connection (MongoDB):

    • Define configuration options for the MongoDB connection (host, port, database name).
    • Implement logic to connect to the MongoDB database using the Mongoose ODM.
    • Configure connection pooling and handle potential connection errors gracefully.
  2. Test Server with MongoDB-Memory-Server:

    • Integrate the mongodb-memory-server package to create an in-memory MongoDB instance for testing purposes.
    • Develop a mechanism to start and stop the in-memory MongoDB server before and after each test case execution.
    • Ensure data isolation for each test by clearing the in-memory database between tests.

Acceptance Criteria: