Skip to content

Commit 86e5a47

Browse files
authored
Merge pull request #1876 from dannyprikaz/1487-backend-test-fixes
1487 backend test fixes
2 parents cd63437 + 0ab8dd0 commit 86e5a47

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

backend/models/project.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ const { Project } = require('./project.model');
22

33
const { setupDB } = require("../setup-test");
44

5-
beforeAll(async () => {
6-
await setupDB("user-model");
7-
});
5+
setupDB("user-model");
86

97
describe("Project Model saves the correct values", () => {
108
test("Save a model instance and then read from the db", async (done) => {

backend/models/user.test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ const { User } = require('./user.model');
22

33
const { setupDB } = require("../setup-test");
44

5-
beforeAll(async () => {
6-
await setupDB("user-model");
7-
});
5+
setupDB("user-model");
86

97
// Please add and expand on this simple test.
108
describe("Question Model saves the correct values", () => {

backend/workers/createRecurringEvents.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const {
77
filterAndCreateEvents,
88
runTask,
99
scheduleTask,
10-
} = require('./createRecurringEvents');
10+
} = jest.requireActual('./createRecurringEvents');
1111
const { generateEventData } = require('./lib/generateEventData');
1212

1313
const MockDate = require('mockdate');
@@ -29,6 +29,11 @@ describe('createRecurringEvents Module Tests', () => {
2929
let mockEvents;
3030
let mockRecurringEvents;
3131

32+
fetch.mockResolvedValue({
33+
ok: true,
34+
json: jest.fn().mockResolvedValue(mockEvents),
35+
});
36+
3237
beforeEach(() => {
3338
MockDate.set('2023-11-02T00:00:00Z');
3439

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
"test:cy": "dotenv -e ./backend/.env -e ./client/.env cross-var start-test dev:api %BACKEND_PORT% dev:client %CLIENT_PORT% cy:run",
1414
"test:backend": "cd backend && npm run test",
1515
"test:client": "cd client && npm run test",
16-
"test:client-mvp": "cd client-mvp-04 && npm run test",
17-
"test:all": "cross-env NODE_ENV=test npm run test:client && npm run test:client-mvp && npm run test:backend && npm run test:cy"
16+
"test:all": "cross-env NODE_ENV=test npm run test:client && npm run test:backend"
1817
},
1918
"dependencies": {
2019
"@mui/icons-material": "^5.14.19",

0 commit comments

Comments
 (0)