-
Notifications
You must be signed in to change notification settings - Fork 12
feat(tests): refactor test files for consistency and readability #20
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -251,8 +251,7 @@ AUTH0_M2M_CLIENT_SECRET=your_m2m_client_secret | |||||||||||||
| AUTH0_TENANT_DOMAIN=your-auth0-tenant-domain.auth0.com | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| > [!IMPORTANT] | ||||||||||||||
| > **Note**: MongoDB connection string should be in the format: `mongodb+srv://<username>:<password>@cluster.mongodb.net/<dbname>?retryWrites=true&w=majority`. Alternatively, if you are using a local MongoDB instance, it can be `mongodb://localhost:27017/collabify`. | ||||||||||||||
| > [!IMPORTANT] > **Note**: MongoDB connection string should be in the format: `mongodb+srv://<username>:<password>@cluster.mongodb.net/<dbname>?retryWrites=true&w=majority`. Alternatively, if you are using a local MongoDB instance, it can be `mongodb://localhost:27017/collabify`. | ||||||||||||||
|
||||||||||||||
| > [!IMPORTANT] > **Note**: MongoDB connection string should be in the format: `mongodb+srv://<username>:<password>@cluster.mongodb.net/<dbname>?retryWrites=true&w=majority`. Alternatively, if you are using a local MongoDB instance, it can be `mongodb://localhost:27017/collabify`. | |
| > [!IMPORTANT] | |
| > **Note**: MongoDB connection string should be in the format: `mongodb+srv://<username>:<password>@cluster.mongodb.net/<dbname>?retryWrites=true&w=majority`. Alternatively, if you are using a local MongoDB instance, it can be `mongodb://localhost:27017/collabify`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the [!IMPORTANT] block, the [!CAUTION] admonition has been changed to a single-line format that will not render correctly. Please revert it to the proper multi-line blockquote format.
| > [!CAUTION] > **Disclaimer:** I strongly believe that Auth0 is on its way to becoming the best authentication solution for web applications. It is a powerful tool that simplifies the authentication process and provides a wide range of features to enhance security and user experience. However, please note that this is my personal opinion, and I encourage you to evaluate different authentication solutions based on your specific needs and requirements - it does not have to be Auth0, and this project has been designed to make it easy to switch to another provider if you so choose! | |
| > [!CAUTION] | |
| > **Disclaimer:** I strongly believe that Auth0 is on its way to becoming the best authentication solution for web applications. It is a powerful tool that simplifies the authentication process and provides a wide range of features to enhance security and user experience. However, please note that this is my personal opinion, and I encourage you to evaluate different authentication solutions based on your specific needs and requirements - it does not have to be Auth0, and this project has been designed to make it easy to switch to another provider if you so choose! |
Copilot
AI
Feb 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to line 254, this admonition block formatting has been changed in a way that will likely break the rendering. The original format with the [!CAUTION] marker on a separate line from the content is the correct GitHub-flavored Markdown syntax. Combining them on one line with a > separator will prevent it from rendering as a caution admonition block.
| > [!CAUTION] > **Disclaimer:** I strongly believe that Auth0 is on its way to becoming the best authentication solution for web applications. It is a powerful tool that simplifies the authentication process and provides a wide range of features to enhance security and user experience. However, please note that this is my personal opinion, and I encourage you to evaluate different authentication solutions based on your specific needs and requirements - it does not have to be Auth0, and this project has been designed to make it easy to switch to another provider if you so choose! | |
| > [!CAUTION] | |
| > **Disclaimer:** I strongly believe that Auth0 is on its way to becoming the best authentication solution for web applications. It is a powerful tool that simplifies the authentication process and provides a wide range of features to enhance security and user experience. However, please note that this is my personal opinion, and I encourage you to evaluate different authentication solutions based on your specific needs and requirements - it does not have to be Auth0, and this project has been designed to make it easy to switch to another provider if you so choose! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| const { createMocks } = require('node-mocks-http') | ||
| const handler = require('../../pages/api/dashboard').default | ||
| jest.mock('@auth0/nextjs-auth0', () => ({ getSession: jest.fn() })) | ||
| jest.mock('../../lib/mongodb', () => ({ dbConnect: jest.fn() })) | ||
| jest.mock('../../models/Project', () => ({ find: jest.fn().mockReturnValue([]) })) | ||
| const { createMocks } = require("node-mocks-http"); | ||
| const handler = require("../../pages/api/dashboard").default; | ||
| jest.mock("@auth0/nextjs-auth0", () => ({ getSession: jest.fn() })); | ||
| jest.mock("../../lib/mongodb", () => ({ dbConnect: jest.fn() })); | ||
| jest.mock("../../models/Project", () => ({ | ||
| find: jest.fn().mockReturnValue([]), | ||
| })); | ||
|
|
||
| it('returns 401 if unauthenticated', async () => { | ||
| require('@auth0/nextjs-auth0').getSession.mockResolvedValue(null) | ||
| const { req, res } = createMocks() | ||
| await handler(req, res) | ||
| expect(res._getStatusCode()).toBe(401) | ||
| }) | ||
| it("returns 401 if unauthenticated", async () => { | ||
| require("@auth0/nextjs-auth0").getSession.mockResolvedValue(null); | ||
| const { req, res } = createMocks(); | ||
| await handler(req, res); | ||
| expect(res._getStatusCode()).toBe(401); | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| const { createMocks } = require('node-mocks-http') | ||
| const handler = require('../../pages/api/openapi').default | ||
| jest.mock('../../utils/openapiSpec', () => ({ ok: true })) | ||
| const { createMocks } = require("node-mocks-http"); | ||
| const handler = require("../../pages/api/openapi").default; | ||
| jest.mock("../../utils/openapiSpec", () => ({ ok: true })); | ||
|
|
||
| test('openapi returns spec', async () => { | ||
| const { req, res } = createMocks() | ||
| await handler(req, res) | ||
| expect(res._getStatusCode()).toBe(200) | ||
| expect(res._getJSONData()).toEqual({ ok: true }) | ||
| }) | ||
| test("openapi returns spec", async () => { | ||
| const { req, res } = createMocks(); | ||
| await handler(req, res); | ||
| expect(res._getStatusCode()).toBe(200); | ||
| expect(res._getJSONData()).toEqual({ ok: true }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new single-line format for the
[!IMPORTANT]admonition block is incorrect and will not render as intended on GitHub. To ensure it displays correctly, it should be restored to the multi-line blockquote format.