mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
fix tests, remove debugging info
This commit is contained in:
parent
45e6b80a2f
commit
b2144345d0
4 changed files with 9 additions and 7 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
const Folders = require('../models/folders');
|
const Folders = require('../models/folders');
|
||||||
const ObjectId = require('mongodb').ObjectId;
|
const ObjectId = require('mongodb').ObjectId;
|
||||||
const Quiz = require('../models/quiz');
|
const Quizzes = require('../models/quiz');
|
||||||
|
|
||||||
describe('Folders', () => {
|
describe('Folders', () => {
|
||||||
let folders;
|
let folders;
|
||||||
|
|
@ -24,8 +24,9 @@ describe('Folders', () => {
|
||||||
collection: jest.fn().mockReturnValue(collection),
|
collection: jest.fn().mockReturnValue(collection),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialize the Folders model with the mocked db
|
quizzes = new Quizzes(db);
|
||||||
folders = new Folders(db);
|
folders = new Folders(db, quizzes);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('folderExists', () => {
|
describe('folderExists', () => {
|
||||||
|
|
@ -81,7 +82,7 @@ describe('Folders', () => {
|
||||||
jest.spyOn(folders, 'getFolderWithContent').mockResolvedValue(sourceFolder);
|
jest.spyOn(folders, 'getFolderWithContent').mockResolvedValue(sourceFolder);
|
||||||
jest.spyOn(folders, 'create').mockResolvedValue(newFolderId);
|
jest.spyOn(folders, 'create').mockResolvedValue(newFolderId);
|
||||||
// Mock the response from Quiz.createQuiz
|
// Mock the response from Quiz.createQuiz
|
||||||
jest.spyOn(Quiz, 'create').mockImplementation(() => {});
|
jest.spyOn(quizzes, 'create').mockImplementation(() => {});
|
||||||
|
|
||||||
const result = await folders.copy(folderId, userId);
|
const result = await folders.copy(folderId, userId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@ const { setupWebsocket } = require("../socket/socket");
|
||||||
|
|
||||||
process.env.NODE_ENV = "test";
|
process.env.NODE_ENV = "test";
|
||||||
|
|
||||||
const BACKEND_PORT = 4400;
|
// pick a random port number for testing
|
||||||
|
const BACKEND_PORT = Math.ceil(Math.random() * 1000 + 3000);
|
||||||
const BACKEND_URL = "http://localhost";
|
const BACKEND_URL = "http://localhost";
|
||||||
|
|
||||||
const BACKEND_API = `${BACKEND_URL}:${BACKEND_PORT}`;
|
const BACKEND_API = `${BACKEND_URL}:${BACKEND_PORT}`;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ const { ObjectId } = require('mongodb');
|
||||||
class Quiz {
|
class Quiz {
|
||||||
|
|
||||||
constructor(db) {
|
constructor(db) {
|
||||||
console.log("Quiz constructor: db", db)
|
// console.log("Quiz constructor: db", db)
|
||||||
this.db = db;
|
this.db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const { USER_ALREADY_EXISTS } = require('../constants/errorCodes');
|
||||||
|
|
||||||
class Users {
|
class Users {
|
||||||
constructor(db, foldersModel) {
|
constructor(db, foldersModel) {
|
||||||
console.log("Users constructor: db", db)
|
// console.log("Users constructor: db", db)
|
||||||
this.db = db;
|
this.db = db;
|
||||||
this.folders = foldersModel;
|
this.folders = foldersModel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue