From 1ffe773e7cb98126bcb7b9f59ab50d15d327babf Mon Sep 17 00:00:00 2001 From: Ijemma Onwuzulike Date: Thu, 16 Feb 2023 08:34:54 -0500 Subject: [PATCH] chore: revert documentData changes --- .eslintrc.json | 3 +++ .github/workflows/integration.yml | 2 +- .github/workflows/lint.yml | 2 +- __tests__/__mocks__/documentData.js | 8 ++++++-- src/services/database.js | 3 ++- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 41c333dc..a66b3b17 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,15 +19,18 @@ "cypress" ], "rules": { + "function-call-argument-newline": ["off"], "function-paren-newline": ["off"], "import/prefer-default-export": ["off"], "max-len": ["error", { "code": 120 }], "newline-per-chained-call": ["off"], "no-console": ["off"], "no-nested-ternary": ["off"], + "no-promise-executor-return": ["off"], "no-underscore-dangle": ["off"], "semi": ["error", "always"], "react/jsx-filename-extension": ["off"], + "react/function-component-definition": ["off"], "react/jsx-props-no-spreading": ["off"], "react/no-danger": ["off"], "@next/next/no-html-link-for-pages": ["off"], diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 1ab21282..6e611509 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -12,7 +12,7 @@ jobs: test: name: Build and Test runs-on: ubuntu-latest - timeout-minutes: 7 + timeout-minutes: 10 strategy: matrix: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fd3aef82..f1c927e7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,4 +20,4 @@ jobs: run: yarn install - name: Run ESLint - run: yarn run eslint ./src --ext .js,.jsx,.ts,.tsx \ No newline at end of file + run: yarn run eslint ./src --ext .js,.jsx,.ts,.tsx -c ./.eslintrc.json \ No newline at end of file diff --git a/__tests__/__mocks__/documentData.js b/__tests__/__mocks__/documentData.js index ef2c2c81..886ba35a 100644 --- a/__tests__/__mocks__/documentData.js +++ b/__tests__/__mocks__/documentData.js @@ -1,5 +1,9 @@ -const wordId = '5f864d7401203866b6546dd3'; -const exampleId = '5f864d7401203866b6546dd3'; +import mongoose from 'mongoose'; + +const { ObjectId } = mongoose.Types; + +const wordId = new ObjectId('5f864d7401203866b6546dd3'); +const exampleId = new ObjectId('5f864d7401203866b6546dd3'); const developerData = { name: 'Developer', email: 'developer@example.com', diff --git a/src/services/database.js b/src/services/database.js index 27369564..9d4c0654 100644 --- a/src/services/database.js +++ b/src/services/database.js @@ -1,5 +1,5 @@ import mongoose from 'mongoose'; -import { MONGO_URI, isProduction } from '../config'; +import { MONGO_URI, isProduction, isTest } from '../config'; const DISCONNECTED = 0; @@ -10,6 +10,7 @@ export const createDbConnection = () => { useNewUrlParser: true, useUnifiedTopology: true, autoIndex: true, + readPreference: isTest ? 'primary' : 'nearest', }); console.log('Attempting MongoDB URI:', MONGO_URI);