Skip to content

Commit 202c807

Browse files
Mt/scrum 138 child 139 backend testing timetablesController, restrictionsController (#84)
1 parent 4bb785f commit 202c807

File tree

11 files changed

+1211
-60
lines changed

11 files changed

+1211
-60
lines changed

course-matrix/backend/__tests__/restrictionsController.test.ts

Lines changed: 551 additions & 0 deletions
Large diffs are not rendered by default.

course-matrix/backend/__tests__/timetablesController.test.ts

Lines changed: 431 additions & 0 deletions
Large diffs are not rendered by default.

course-matrix/backend/jest.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ import type { Config } from "jest";
22

33
const config: Config = {
44
preset: "ts-jest",
5-
moduleNameMapper: { "\\.(css|scss)$": "identity-obj-proxy" },
5+
moduleNameMapper: {
6+
"\\.(css|scss)$": "identity-obj-proxy",
7+
"^(\\.{1,2}/.*)\\.js$": "$1",
8+
},
69
// to obtain access to the matchers.
710
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
811
modulePaths: ["<rootDir>"],
@@ -16,6 +19,10 @@ const config: Config = {
1619
],
1720
"^.+\\.(js|jsx)$": "babel-jest",
1821
},
22+
transformIgnorePatterns: [
23+
"/node_modules/(?!(node-cron|uuid)/)", // Keep transforming `node-cron`
24+
],
25+
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
1926
};
2027

2128
export default config;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import fetch from "node-fetch";
2+
3+
// Polyfill the global fetch for Pinecone to use
4+
globalThis.fetch = fetch as unknown as WindowOrWorkerGlobalScope["fetch"];
5+
globalThis.TransformStream = require("stream/web").TransformStream;
6+
globalThis.TextEncoder = require("util").TextEncoder;
7+
globalThis.TextDecoder = require("util").TextDecoder;
8+
globalThis.ReadableStream = require("stream/web").ReadableStream;
9+
globalThis.TransformStream = require("stream/web").TransformStream;
10+
globalThis.WritableStream = require("stream/web").WritableStream;

course-matrix/backend/package-lock.json

Lines changed: 176 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)