Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test case for backend is failing #3

Open
qriz1452 opened this issue Aug 21, 2023 · 0 comments
Open

Test case for backend is failing #3

qriz1452 opened this issue Aug 21, 2023 · 0 comments

Comments

@qriz1452
Copy link

Here is the console output for the failed testcase :


+ npm test

> [email protected] test
> cross-env NODE_ENV=test jest --testTimeout=5000

FAIL tests/activity.test.js
  GET /api/activities
    ✕ should get all the activities (4 ms)

  ● GET /api/activities › should get all the activities

    MongooseError: The `uri` parameter to `openUri()` must be a string, got "undefined". Make sure the first parameter to `mongoose.connect()` or `mongoose.createConnection()` is a string.

       8 | /* Connecting to the database before each test. */
       9 | beforeEach(async () => {
    > 10 |   await mongoose.connect(process.env.MONGODB_URI);
         |                  ^
      11 | });
      12 |
      13 | /* Closing database connection after each test. */

      at NativeConnection.Object.<anonymous>.Connection.openUri (node_modules/mongoose/lib/connection.js:689:11)
      at node_modules/mongoose/lib/index.js:379:10
      at node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5
      at promiseOrCallback (node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10)
      at Mongoose.Object.<anonymous>.Mongoose._promiseOrCallback (node_modules/mongoose/lib/index.js:1224:10)
      at Mongoose.Object.<anonymous>.Mongoose.connect (node_modules/mongoose/lib/index.js:378:20)
      at Object.connect (tests/activity.test.js:10:18)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        1.492 s
Ran all test suites.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant