Update paths
GitOrigin-RevId: a9474c8f36e8b287de4dd8fda29bc082001444ac
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
import { expect } from 'chai'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import Path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import fs from 'node:fs'
|
||||
import Settings from '@overleaf/settings'
|
||||
import _ from 'lodash'
|
||||
import ProjectGetter from '../../../../../app/src/Features/Project/ProjectGetter.js'
|
||||
import ProjectGetter from '../../../../../app/src/Features/Project/ProjectGetter.mjs'
|
||||
import User from '../../../../../test/acceptance/src/helpers/User.mjs'
|
||||
import MockDocUpdaterApiClass from '../../../../../test/acceptance/src/mocks/MockDocUpdaterApi.mjs'
|
||||
|
||||
const { ObjectId } = mongodb
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
const FILES_PATH = Path.join(__dirname, '../../../../../test/acceptance/files')
|
||||
const FILES_PATH = Path.join(
|
||||
import.meta.dirname,
|
||||
'../../../../../test/acceptance/files'
|
||||
)
|
||||
|
||||
let MockDocUpdaterApi
|
||||
|
||||
|
||||
@@ -2,18 +2,17 @@ import OError from '@overleaf/o-error'
|
||||
import { expressify } from '@overleaf/promise-utils'
|
||||
import Settings from '@overleaf/settings'
|
||||
import Path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import logger from '@overleaf/logger'
|
||||
import UserRegistrationHandler from '../../../../app/src/Features/User/UserRegistrationHandler.mjs'
|
||||
import EmailHandler from '../../../../app/src/Features/Email/EmailHandler.js'
|
||||
import UserGetter from '../../../../app/src/Features/User/UserGetter.js'
|
||||
import { User } from '../../../../app/src/models/User.js'
|
||||
import AuthenticationManager from '../../../../app/src/Features/Authentication/AuthenticationManager.js'
|
||||
import AuthenticationController from '../../../../app/src/Features/Authentication/AuthenticationController.js'
|
||||
import AuthenticationController from '../../../../app/src/Features/Authentication/AuthenticationController.mjs'
|
||||
import SessionManager from '../../../../app/src/Features/Authentication/SessionManager.js'
|
||||
import { hasAdminAccess } from '../../../../app/src/Features/Helpers/AdminAuthorizationHelper.js'
|
||||
import AdminAuthorizationHelper from '../../../../app/src/Features/Helpers/AdminAuthorizationHelper.mjs'
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
const { hasAdminAccess } = AdminAuthorizationHelper
|
||||
|
||||
/**
|
||||
* Container for functions that need to be mocked in tests
|
||||
@@ -53,7 +52,7 @@ async function launchpadPage(req, res) {
|
||||
|
||||
if (!sessionUser) {
|
||||
if (!adminUserExists) {
|
||||
res.render(Path.resolve(__dirname, '../views/launchpad'), {
|
||||
res.render(Path.resolve(import.meta.dirname, '../views/launchpad'), {
|
||||
adminUserExists,
|
||||
authMethod,
|
||||
})
|
||||
@@ -66,7 +65,7 @@ async function launchpadPage(req, res) {
|
||||
isAdmin: 1,
|
||||
})
|
||||
if (hasAdminAccess(user)) {
|
||||
res.render(Path.resolve(__dirname, '../views/launchpad'), {
|
||||
res.render(Path.resolve(import.meta.dirname, '../views/launchpad'), {
|
||||
wsUrl: Settings.wsUrl,
|
||||
adminUserExists,
|
||||
authMethod,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import logger from '@overleaf/logger'
|
||||
|
||||
import LaunchpadController from './LaunchpadController.mjs'
|
||||
import AuthenticationController from '../../../../app/src/Features/Authentication/AuthenticationController.js'
|
||||
import AuthenticationController from '../../../../app/src/Features/Authentication/AuthenticationController.mjs'
|
||||
import AuthorizationMiddleware from '../../../../app/src/Features/Authorization/AuthorizationMiddleware.mjs'
|
||||
|
||||
export default {
|
||||
|
||||
@@ -57,7 +57,7 @@ describe('LaunchpadController', function () {
|
||||
}))
|
||||
|
||||
vi.doMock(
|
||||
'../../../../../app/src/Features/Authentication/AuthenticationController.js',
|
||||
'../../../../../app/src/Features/Authentication/AuthenticationController.mjs',
|
||||
() => ({
|
||||
default: (ctx.AuthenticationController = {}),
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import UserGetter from '../../../app/src/Features/User/UserGetter.js'
|
||||
import UserDeleter from '../../../app/src/Features/User/UserDeleter.js'
|
||||
import UserDeleter from '../../../app/src/Features/User/UserDeleter.mjs'
|
||||
import { fileURLToPath } from 'url'
|
||||
import minimist from 'minimist'
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
renameSync,
|
||||
} from 'fs'
|
||||
import { pipeline } from 'stream/promises'
|
||||
import DocumentUpdaterHandler from '../../../app/src/Features/DocumentUpdater/DocumentUpdaterHandler.js'
|
||||
import DocumentUpdaterHandler from '../../../app/src/Features/DocumentUpdater/DocumentUpdaterHandler.mjs'
|
||||
import ProjectZipStreamManager from '../../../app/src/Features/Downloads/ProjectZipStreamManager.mjs'
|
||||
import logger from '@overleaf/logger'
|
||||
import { promisify } from '@overleaf/promise-utils'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import logger from '@overleaf/logger'
|
||||
import UserActivateController from './UserActivateController.mjs'
|
||||
import AuthenticationController from '../../../../app/src/Features/Authentication/AuthenticationController.js'
|
||||
import AuthenticationController from '../../../../app/src/Features/Authentication/AuthenticationController.mjs'
|
||||
import AuthorizationMiddleware from '../../../../app/src/Features/Authorization/AuthorizationMiddleware.mjs'
|
||||
|
||||
export default {
|
||||
|
||||
Reference in New Issue
Block a user