mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
Convert top level acceptance tests to ES module
GitOrigin-RevId: ab45010ec557d62576c470d2e024549e67261c66
This commit is contained in:
parent
4f0b860cf6
commit
e0dba75b81
75 changed files with 430 additions and 380 deletions
|
@ -2,9 +2,9 @@ import '../../../../../test/acceptance/src/helpers/InitApp.mjs'
|
|||
import MockDocstoreApi from '../../../../../test/acceptance/src/mocks/MockDocstoreApi.js'
|
||||
import MockDocUpdaterApi from '../../../../../test/acceptance/src/mocks/MockDocUpdaterApi.js'
|
||||
import MockFilestoreApi from '../../../../../test/acceptance/src/mocks/MockFilestoreApi.js'
|
||||
import MockNotificationsApi from '../../../../../test/acceptance/src/mocks/MockNotificationsApi.js'
|
||||
import MockNotificationsApi from '../../../../../test/acceptance/src/mocks/MockNotificationsApi.mjs'
|
||||
import MockProjectHistoryApi from '../../../../../test/acceptance/src/mocks/MockProjectHistoryApi.js'
|
||||
import MockSpellingApi from '../../../../../test/acceptance/src/mocks/MockSpellingApi.js'
|
||||
import MockSpellingApi from '../../../../../test/acceptance/src/mocks/MockSpellingApi.mjs'
|
||||
import MockV1Api from '../../../../../test/acceptance/src/mocks/MockV1Api.js'
|
||||
import MockV1HistoryApi from '../../../../../test/acceptance/src/mocks/MockV1HistoryApi.js'
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
const { promisify } = require('util')
|
||||
const { expect } = require('chai')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
const {
|
||||
promises: { getMetric },
|
||||
} = require('./helpers/metrics')
|
||||
const User = require('./helpers/User').promises
|
||||
import { promisify } from 'util'
|
||||
import { expect } from 'chai'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
import MetricsHelper from './helpers/metrics.js'
|
||||
import UserHelper from './helpers/User.js'
|
||||
const sleep = promisify(setTimeout)
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
const getMetric = MetricsHelper.promises.getMetric
|
||||
|
||||
async function getActiveUsersMetric() {
|
||||
return getMetric(line => line.startsWith('num_active_users'))
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
const logger = require('@overleaf/logger')
|
||||
const sinon = require('sinon')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import logger from '@overleaf/logger'
|
||||
import sinon from 'sinon'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('Add secondary email address confirmation code email', function () {
|
||||
let spy
|
|
@ -1,7 +1,7 @@
|
|||
const OError = require('@overleaf/o-error')
|
||||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
import OError from '@overleaf/o-error'
|
||||
import { expect } from 'chai'
|
||||
import async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
|
||||
describe('AdminEmails', function () {
|
||||
beforeEach(function (done) {
|
|
@ -1,6 +1,8 @@
|
|||
const Settings = require('@overleaf/settings')
|
||||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
import Settings from '@overleaf/settings'
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('AdminOnlyLogin', function () {
|
||||
let adminUser, regularUser
|
|
@ -1,9 +1,9 @@
|
|||
const Settings = require('@overleaf/settings')
|
||||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
const {
|
||||
getSafeAdminDomainRedirect,
|
||||
} = require('../../../app/src/Features/Helpers/UrlHelper')
|
||||
import Settings from '@overleaf/settings'
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import { getSafeAdminDomainRedirect } from '../../../app/src/Features/Helpers/UrlHelper.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('AdminPrivilegeAvailable', function () {
|
||||
let adminUser, otherUser
|
|
@ -1,7 +1,11 @@
|
|||
const { expect } = require('chai')
|
||||
const { ObjectId } = require('mongodb-legacy')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const User = require('./helpers/User').promises
|
||||
import { expect } from 'chai'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import Settings from '@overleaf/settings'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const ObjectId = mongodb.ObjectId
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('Authentication', function () {
|
||||
let user
|
|
@ -1,11 +1,10 @@
|
|||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
const request = require('./helpers/request')
|
||||
const settings = require('@overleaf/settings')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
|
||||
const expectErrorResponse = require('./helpers/expectErrorResponse')
|
||||
import { expect } from 'chai'
|
||||
import async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
import request from './helpers/request.js'
|
||||
import settings from '@overleaf/settings'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
import expectErrorResponse from './helpers/expectErrorResponse.js'
|
||||
|
||||
function tryReadAccess(user, projectId, test, callback) {
|
||||
async.series(
|
|
@ -1,9 +1,11 @@
|
|||
const { exec } = require('child_process')
|
||||
const { promisify } = require('util')
|
||||
const { expect } = require('chai')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
const User = require('./helpers/User').promises
|
||||
import { exec } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import { expect } from 'chai'
|
||||
import logger from '@overleaf/logger'
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
async function getDeletedFiles(projectId) {
|
||||
return (await db.projects.findOne({ _id: projectId })).deletedFiles
|
|
@ -1,9 +1,11 @@
|
|||
const { exec } = require('child_process')
|
||||
const { promisify } = require('util')
|
||||
const { expect } = require('chai')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
const User = require('./helpers/User').promises
|
||||
import { exec } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import { expect } from 'chai'
|
||||
import logger from '@overleaf/logger'
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
async function getDeletedDocs(projectId) {
|
||||
return (await db.projects.findOne({ _id: projectId })).deletedDocs
|
|
@ -1,8 +1,8 @@
|
|||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
const { promisify } = require('util')
|
||||
const { exec } = require('child_process')
|
||||
const logger = require('@overleaf/logger/logging-manager')
|
||||
const { expect } = require('chai')
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import { promisify } from 'util'
|
||||
import { exec } from 'child_process'
|
||||
import logger from '@overleaf/logger'
|
||||
import { expect } from 'chai'
|
||||
|
||||
describe('BackFillDocRevTests', function () {
|
||||
const docId1 = new ObjectId()
|
|
@ -1,9 +1,9 @@
|
|||
const { exec } = require('child_process')
|
||||
const { promisify } = require('util')
|
||||
const { expect } = require('chai')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { filterOutput } = require('./helpers/settings')
|
||||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
import { exec } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import { expect } from 'chai'
|
||||
import logger from '@overleaf/logger'
|
||||
import { filterOutput } from './helpers/settings.mjs'
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
|
||||
const DUMMY_NAME = 'unknown.tex'
|
||||
const DUMMY_TIME = new Date('2021-04-12T00:00:00.000Z')
|
|
@ -1,6 +1,6 @@
|
|||
const { spawnSync } = require('child_process')
|
||||
const { expect } = require('chai')
|
||||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
import { spawnSync } from 'child_process'
|
||||
import { expect } from 'chai'
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
|
||||
describe('BatchedUpdateTests', function () {
|
||||
it('can handle non linear insert order', async function () {
|
|
@ -1,5 +1,5 @@
|
|||
const { expect } = require('chai')
|
||||
const UserHelper = require('../src/helpers/UserHelper')
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from '../src/helpers/UserHelper.js'
|
||||
|
||||
describe('BetaProgram', function () {
|
||||
let email, userHelper
|
|
@ -1,5 +1,5 @@
|
|||
const Settings = require('@overleaf/settings')
|
||||
const request = require('./helpers/request')
|
||||
import Settings from '@overleaf/settings'
|
||||
import request from './helpers/request.js'
|
||||
|
||||
// create a string that is longer than the max allowed (as defined in Server.js)
|
||||
const wayTooLongString = 'a'.repeat(Settings.max_json_request_size + 1)
|
|
@ -1,8 +1,10 @@
|
|||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
const {
|
||||
promises: { getMetric },
|
||||
} = require('./helpers/metrics')
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import MetricsHelper from './helpers/metrics.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
const getMetric = MetricsHelper.promises.getMetric
|
||||
|
||||
describe('CDNMigration', function () {
|
||||
let anon, user
|
|
@ -1,8 +1,10 @@
|
|||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const { expect } = require('chai')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const User = require('./helpers/User').promises
|
||||
const MockHaveIBeenPwnedApiClass = require('./mocks/MockHaveIBeenPwnedApi')
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import { expect } from 'chai'
|
||||
import Settings from '@overleaf/settings'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import MockHaveIBeenPwnedApiClass from './mocks/MockHaveIBeenPwnedApi.mjs'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
let MockHaveIBeenPwnedApi
|
||||
before(function () {
|
|
@ -10,8 +10,9 @@
|
|||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const Settings = require('@overleaf/settings')
|
||||
const request = require('./helpers/request')
|
||||
import Settings from '@overleaf/settings'
|
||||
|
||||
import request from './helpers/request.js'
|
||||
|
||||
describe('siteIsOpen', function () {
|
||||
describe('when siteIsOpen is default (true)', function () {
|
|
@ -1,16 +1,13 @@
|
|||
const sinon = require('sinon')
|
||||
const chai = require('chai')
|
||||
const { expect } = require('chai')
|
||||
import sinon from 'sinon'
|
||||
import chai, { expect } from 'chai'
|
||||
import chaiAsPromised from 'chai-as-promised'
|
||||
import sinonChai from 'sinon-chai'
|
||||
import { main } from '../../../scripts/recurly/collect_paypal_past_due_invoice.js'
|
||||
import RecurlyWrapper from '../../../app/src/Features/Subscription/RecurlyWrapper.js'
|
||||
import OError from '@overleaf/o-error'
|
||||
|
||||
chai.use(require('chai-as-promised'))
|
||||
chai.use(require('sinon-chai'))
|
||||
|
||||
const {
|
||||
main,
|
||||
} = require('../../../scripts/recurly/collect_paypal_past_due_invoice')
|
||||
|
||||
const RecurlyWrapper = require('../../../app/src/Features/Subscription/RecurlyWrapper')
|
||||
const OError = require('@overleaf/o-error')
|
||||
chai.use(chaiAsPromised)
|
||||
chai.use(sinonChai)
|
||||
|
||||
// from https://recurly.com/developers/api-v2/v2.21/#operation/listInvoices
|
||||
const invoicesXml = invoiceIds => `
|
|
@ -1,8 +1,11 @@
|
|||
const { expect } = require('chai')
|
||||
const { exec } = require('child_process')
|
||||
const { ObjectId } = require('mongodb-legacy')
|
||||
import { expect } from 'chai'
|
||||
import { exec } from 'child_process'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = require('./helpers/User').promises
|
||||
const User = UserHelper.promises
|
||||
|
||||
const ObjectId = mongodb.ObjectId
|
||||
|
||||
describe('ConvertArchivedState', function () {
|
||||
let userOne, userTwo, userThree, userFour
|
|
@ -1,11 +1,14 @@
|
|||
const Settings = require('@overleaf/settings')
|
||||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
const {
|
||||
promises: { getMetric },
|
||||
resetMetrics,
|
||||
} = require('./helpers/metrics')
|
||||
const cookieSignature = require('cookie-signature')
|
||||
import Settings from '@overleaf/settings'
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import MetricsHelper from './helpers/metrics.js'
|
||||
import cookieSignature from 'cookie-signature'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
const getMetric = MetricsHelper.promises.getMetric
|
||||
|
||||
const resetMetrics = MetricsHelper.resetMetrics
|
||||
|
||||
async function getSessionCookieMetric(status) {
|
||||
return getMetric(
|
|
@ -1,9 +1,9 @@
|
|||
const { exec } = require('child_process')
|
||||
const { promisify } = require('util')
|
||||
const { expect } = require('chai')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { filterOutput } = require('./helpers/settings')
|
||||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
import { exec } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import { expect } from 'chai'
|
||||
import logger from '@overleaf/logger'
|
||||
import { filterOutput } from './helpers/settings.mjs'
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
|
||||
const ONE_DAY_IN_S = 60 * 60 * 24
|
||||
const BATCH_SIZE = 3
|
|
@ -1,15 +1,15 @@
|
|||
const User = require('./helpers/User')
|
||||
const Subscription = require('./helpers/Subscription')
|
||||
const request = require('./helpers/request')
|
||||
const async = require('async')
|
||||
const { expect } = require('chai')
|
||||
const settings = require('@overleaf/settings')
|
||||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
const MockDocstoreApiClass = require('./mocks/MockDocstoreApi')
|
||||
const MockFilestoreApiClass = require('./mocks/MockFilestoreApi')
|
||||
const MockChatApiClass = require('./mocks/MockChatApi')
|
||||
const MockGitBridgeApiClass = require('./mocks/MockGitBridgeApi')
|
||||
import User from './helpers/User.js'
|
||||
import Subscription from './helpers/Subscription.js'
|
||||
import request from './helpers/request.js'
|
||||
import async from 'async'
|
||||
import { expect } from 'chai'
|
||||
import settings from '@overleaf/settings'
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
import MockDocstoreApiClass from './mocks/MockDocstoreApi.js'
|
||||
import MockFilestoreApiClass from './mocks/MockFilestoreApi.js'
|
||||
import MockChatApiClass from './mocks/MockChatApi.mjs'
|
||||
import MockGitBridgeApiClass from './mocks/MockGitBridgeApi.mjs'
|
||||
|
||||
let MockDocstoreApi, MockFilestoreApi, MockChatApi, MockGitBridgeApi
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
const User = require('./helpers/User')
|
||||
const request = require('./helpers/request')
|
||||
const { expect } = require('chai')
|
||||
const settings = require('@overleaf/settings')
|
||||
const { ObjectId } = require('mongodb-legacy')
|
||||
import User from './helpers/User.js'
|
||||
import request from './helpers/request.js'
|
||||
import { expect } from 'chai'
|
||||
import settings from '@overleaf/settings'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
|
||||
const ObjectId = mongodb.ObjectId
|
||||
|
||||
describe('DocUpdate', function () {
|
||||
beforeEach(function (done) {
|
|
@ -1,5 +1,5 @@
|
|||
const User = require('./helpers/User')
|
||||
const { expect } = require('chai')
|
||||
import User from './helpers/User.js'
|
||||
import { expect } from 'chai'
|
||||
|
||||
describe('EditorHttpController', function () {
|
||||
beforeEach('login', function (done) {
|
|
@ -1,9 +1,13 @@
|
|||
const Settings = require('@overleaf/settings')
|
||||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
const MockHaveIBeenPwnedApiClass = require('./mocks/MockHaveIBeenPwnedApi')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const { getMetric } = require('./helpers/metrics').promises
|
||||
import Settings from '@overleaf/settings'
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import MockHaveIBeenPwnedApiClass from './mocks/MockHaveIBeenPwnedApi.mjs'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import MetricsHelper from './helpers/metrics.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
const getMetric = MetricsHelper.promises.getMetric
|
||||
|
||||
let MockHaveIBeenPwnedApi
|
||||
before(function () {
|
||||
|
@ -11,19 +15,19 @@ before(function () {
|
|||
})
|
||||
|
||||
async function getMetricReUsed() {
|
||||
return getMetric(
|
||||
return await getMetric(
|
||||
line => line.includes('password_re_use') && line.includes('re-used')
|
||||
)
|
||||
}
|
||||
|
||||
async function getMetricUnique() {
|
||||
return getMetric(
|
||||
return await getMetric(
|
||||
line => line.includes('password_re_use') && line.includes('unique')
|
||||
)
|
||||
}
|
||||
|
||||
async function getMetricFailure() {
|
||||
return getMetric(
|
||||
return await getMetric(
|
||||
line => line.includes('password_re_use') && line.includes('failure')
|
||||
)
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
const { expect } = require('chai')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const User = require('./helpers/User').promises
|
||||
import { expect } from 'chai'
|
||||
import Settings from '@overleaf/settings'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('HealthCheckController', function () {
|
||||
describe('SmokeTests', function () {
|
|
@ -1,6 +1,6 @@
|
|||
const { expect } = require('chai')
|
||||
const fetch = require('node-fetch')
|
||||
const Settings = require('@overleaf/settings')
|
||||
import { expect } from 'chai'
|
||||
import fetch from 'node-fetch'
|
||||
import Settings from '@overleaf/settings'
|
||||
|
||||
const BASE_URL = `http://${process.env.HTTP_TEST_HOST || '127.0.0.1'}:23000`
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
import './helpers/InitApp.mjs'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
|
||||
import MockAnalyticsApi from './mocks/MockAnalyticsApi.js'
|
||||
import MockChatApi from './mocks/MockChatApi.js'
|
||||
import MockClsiApi from './mocks/MockClsiApi.js'
|
||||
import MockAnalyticsApi from './mocks/MockAnalyticsApi.mjs'
|
||||
import MockChatApi from './mocks/MockChatApi.mjs'
|
||||
import MockClsiApi from './mocks/MockClsiApi.mjs'
|
||||
import MockDocstoreApi from './mocks/MockDocstoreApi.js'
|
||||
import MockDocUpdaterApi from './mocks/MockDocUpdaterApi.js'
|
||||
import MockFilestoreApi from './mocks/MockFilestoreApi.js'
|
||||
import MockGitBridgeApi from './mocks/MockGitBridgeApi.js'
|
||||
import MockNotificationsApi from './mocks/MockNotificationsApi.js'
|
||||
import MockGitBridgeApi from './mocks/MockGitBridgeApi.mjs'
|
||||
import MockNotificationsApi from './mocks/MockNotificationsApi.mjs'
|
||||
import MockProjectHistoryApi from './mocks/MockProjectHistoryApi.js'
|
||||
import MockSpellingApi from './mocks/MockSpellingApi.js'
|
||||
import MockSpellingApi from './mocks/MockSpellingApi.mjs'
|
||||
import MockV1Api from './mocks/MockV1Api.js'
|
||||
import MockV1HistoryApi from './mocks/MockV1HistoryApi.js'
|
||||
import MockHaveIBeenPwnedApi from './mocks/MockHaveIBeenPwnedApi.js'
|
||||
import MockThirdPartyDataStoreApi from './mocks/MockThirdPartyDataStoreApi.js'
|
||||
import MockHaveIBeenPwnedApi from './mocks/MockHaveIBeenPwnedApi.mjs'
|
||||
import MockThirdPartyDataStoreApi from './mocks/MockThirdPartyDataStoreApi.mjs'
|
||||
|
||||
const mockOpts = {
|
||||
debug: ['1', 'true', 'TRUE'].includes(process.env.DEBUG_MOCKS),
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
const { expect } = require('chai')
|
||||
const cheerio = require('cheerio')
|
||||
const User = require('./helpers/User').promises
|
||||
import { expect } from 'chai'
|
||||
import cheerio from 'cheerio'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('Spelling', function () {
|
||||
let user, projectId
|
|
@ -1,15 +1,14 @@
|
|||
const { expect } = require('chai')
|
||||
const _ = require('lodash')
|
||||
const fs = require('fs')
|
||||
const timekeeper = require('timekeeper')
|
||||
import { expect } from 'chai'
|
||||
import _ from 'lodash'
|
||||
import fs from 'fs'
|
||||
import timekeeper from 'timekeeper'
|
||||
import Settings from '@overleaf/settings'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import express from 'express'
|
||||
import { plainTextResponse } from '../../../app/src/infrastructure/Response.js'
|
||||
|
||||
const Settings = require('@overleaf/settings')
|
||||
const User = require('./helpers/User').promises
|
||||
const User = UserHelper.promises
|
||||
|
||||
const express = require('express')
|
||||
const {
|
||||
plainTextResponse,
|
||||
} = require('../../../app/src/infrastructure/Response')
|
||||
const LinkedUrlProxy = express()
|
||||
LinkedUrlProxy.get('/', (req, res, next) => {
|
||||
if (req.query.url === 'http://example.com/foo') {
|
|
@ -1,7 +1,6 @@
|
|||
const { expect } = require('chai')
|
||||
|
||||
const { User } = require('../../../app/src/models/User')
|
||||
const { Subscription } = require('../../../app/src/models/Subscription')
|
||||
import { expect } from 'chai'
|
||||
import { User } from '../../../app/src/models/User.js'
|
||||
import { Subscription } from '../../../app/src/models/Subscription.js'
|
||||
|
||||
describe('mongoose', function () {
|
||||
describe('User', function () {
|
|
@ -1,16 +1,19 @@
|
|||
const { expect } = require('chai')
|
||||
|
||||
const { ObjectId: NativeObjectId } = require('mongodb-legacy')
|
||||
const { ObjectId: MongooseObjectId } = require('mongoose').mongo
|
||||
|
||||
const { User: UserModel } = require('../../../app/src/models/User')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const {
|
||||
import { expect } from 'chai'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import mongoose from 'mongoose'
|
||||
import { User as UserModel } from '../../../app/src/models/User.js'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import {
|
||||
normalizeQuery,
|
||||
normalizeMultiQuery,
|
||||
} = require('../../../app/src/Features/Helpers/Mongo')
|
||||
} from '../../../app/src/Features/Helpers/Mongo.js'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = require('./helpers/User').promises
|
||||
const User = UserHelper.promises
|
||||
|
||||
const NativeObjectId = mongodb.ObjectId
|
||||
|
||||
const MongooseObjectId = mongoose.Types.ObjectId
|
||||
|
||||
describe('MongoTests', function () {
|
||||
let userIdAsString, userEmail, userIds
|
|
@ -1,6 +1,6 @@
|
|||
const { expect } = require('chai')
|
||||
const UserHelper = require('./helpers/UserHelper')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/UserHelper.js'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
|
||||
describe('PasswordReset', function () {
|
||||
let email, response, user, userHelper, token, emailQuery
|
|
@ -1,6 +1,6 @@
|
|||
const { expect } = require('chai')
|
||||
const PasswordResetRouter = require('../../../app/src/Features/PasswordReset/PasswordResetRouter')
|
||||
const UserHelper = require('./helpers/UserHelper')
|
||||
import { expect } from 'chai'
|
||||
import PasswordResetRouter from '../../../app/src/Features/PasswordReset/PasswordResetRouter.js'
|
||||
import UserHelper from './helpers/UserHelper.js'
|
||||
|
||||
describe('PasswordUpdate', function () {
|
||||
let email, password, response, user, userHelper
|
|
@ -1,9 +1,11 @@
|
|||
const UserHelper = require('./helpers/UserHelper')
|
||||
const Settings = require('@overleaf/settings')
|
||||
const { expect } = require('chai')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
const MockV1ApiClass = require('./mocks/MockV1Api')
|
||||
const Subscription = require('./helpers/Subscription').promises
|
||||
import UserHelper from './helpers/UserHelper.js'
|
||||
import Settings from '@overleaf/settings'
|
||||
import { expect } from 'chai'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
import MockV1ApiClass from './mocks/MockV1Api.js'
|
||||
import SubscriptionHelper from './helpers/Subscription.js'
|
||||
|
||||
const Subscription = SubscriptionHelper.promises
|
||||
|
||||
describe('PrimaryEmailCheck', function () {
|
||||
let userHelper
|
|
@ -1,10 +1,14 @@
|
|||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
const { Project } = require('../../../app/src/models/Project')
|
||||
const { ObjectId } = require('mongodb-legacy')
|
||||
const cheerio = require('cheerio')
|
||||
const { Subscription } = require('../../../app/src/models/Subscription')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import { Project } from '../../../app/src/models/Project.js'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import cheerio from 'cheerio'
|
||||
import { Subscription } from '../../../app/src/models/Subscription.js'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
|
||||
const ObjectId = mongodb.ObjectId
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('Project CRUD', function () {
|
||||
beforeEach(async function () {
|
|
@ -1,16 +1,18 @@
|
|||
const { expect } = require('chai')
|
||||
const sinon = require('sinon')
|
||||
const Path = require('path')
|
||||
const fs = require('fs')
|
||||
const _ = require('lodash')
|
||||
const User = require('./helpers/User')
|
||||
const UserHelper = require('./helpers/UserHelper')
|
||||
|
||||
const MockDocstoreApiClass = require('./mocks/MockDocstoreApi')
|
||||
const MockFilestoreApiClass = require('./mocks/MockFilestoreApi')
|
||||
import { expect } from 'chai'
|
||||
import sinon from 'sinon'
|
||||
import Path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import _ from 'lodash'
|
||||
import User from './helpers/User.js'
|
||||
import UserHelper from './helpers/UserHelper.js'
|
||||
import MockDocstoreApiClass from './mocks/MockDocstoreApi.js'
|
||||
import MockFilestoreApiClass from './mocks/MockFilestoreApi.js'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
let MockDocstoreApi, MockFilestoreApi
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
|
||||
before(function () {
|
||||
MockDocstoreApi = MockDocstoreApiClass.instance()
|
||||
MockFilestoreApi = MockFilestoreApiClass.instance()
|
|
@ -10,11 +10,12 @@
|
|||
* DS207: Consider shorter variations of null checks
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
const request = require('./helpers/request')
|
||||
const settings = require('@overleaf/settings')
|
||||
import { expect } from 'chai'
|
||||
|
||||
import async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
import request from './helpers/request.js'
|
||||
import settings from '@overleaf/settings'
|
||||
|
||||
const joinProject = (userId, projectId, callback) =>
|
||||
request.post(
|
|
@ -1,12 +1,12 @@
|
|||
const { expect } = require('chai')
|
||||
const Async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
const settings = require('@overleaf/settings')
|
||||
const CollaboratorsEmailHandler = require('../../../app/src/Features/Collaborators/CollaboratorsEmailHandler')
|
||||
const CollaboratorsInviteHelper = require('../../../app/src/Features/Collaborators/CollaboratorsInviteHelper')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
const cheerio = require('cheerio')
|
||||
const sinon = require('sinon')
|
||||
import { expect } from 'chai'
|
||||
import Async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
import settings from '@overleaf/settings'
|
||||
import CollaboratorsEmailHandler from '../../../app/src/Features/Collaborators/CollaboratorsEmailHandler.js'
|
||||
import CollaboratorsInviteHelper from '../../../app/src/Features/Collaborators/CollaboratorsInviteHelper.js'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
import cheerio from 'cheerio'
|
||||
import sinon from 'sinon'
|
||||
|
||||
let generateTokenSpy
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('Project ownership transfer', function () {
|
||||
beforeEach(async function () {
|
|
@ -12,14 +12,14 @@
|
|||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
|
||||
const LockManager = require('../../../app/src/infrastructure/LockManager')
|
||||
const ProjectCreationHandler = require('../../../app/src/Features/Project/ProjectCreationHandler')
|
||||
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter')
|
||||
const ProjectEntityMongoUpdateHandler = require('../../../app/src/Features/Project/ProjectEntityMongoUpdateHandler')
|
||||
const UserCreator = require('../../../app/src/Features/User/UserCreator')
|
||||
import LockManager from '../../../app/src/infrastructure/LockManager.js'
|
||||
|
||||
const { expect } = require('chai')
|
||||
const _ = require('lodash')
|
||||
import ProjectCreationHandler from '../../../app/src/Features/Project/ProjectCreationHandler.js'
|
||||
import ProjectGetter from '../../../app/src/Features/Project/ProjectGetter.js'
|
||||
import ProjectEntityMongoUpdateHandler from '../../../app/src/Features/Project/ProjectEntityMongoUpdateHandler.js'
|
||||
import UserCreator from '../../../app/src/Features/User/UserCreator.js'
|
||||
import { expect } from 'chai'
|
||||
import _ from 'lodash'
|
||||
|
||||
// These tests are neither acceptance tests nor unit tests. It's difficult to
|
||||
// test/verify that our locking is doing what we hope.
|
|
@ -1,14 +1,19 @@
|
|||
const { expect } = require('chai')
|
||||
const { ObjectId } = require('mongodb-legacy')
|
||||
const Path = require('path')
|
||||
const fs = require('fs')
|
||||
import { expect } from 'chai'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import Path from 'node:path'
|
||||
import fs from 'node:fs'
|
||||
import { Project } from '../../../app/src/models/Project.js'
|
||||
import ProjectGetter from '../../../app/src/Features/Project/ProjectGetter.js'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import MockDocStoreApiClass from './mocks/MockDocstoreApi.js'
|
||||
import MockDocUpdaterApiClass from './mocks/MockDocUpdaterApi.js'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const { Project } = require('../../../app/src/models/Project')
|
||||
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter')
|
||||
const User = UserHelper.promises
|
||||
|
||||
const User = require('./helpers/User').promises
|
||||
const MockDocStoreApiClass = require('./mocks/MockDocstoreApi')
|
||||
const MockDocUpdaterApiClass = require('./mocks/MockDocUpdaterApi')
|
||||
const ObjectId = mongodb.ObjectId
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
|
||||
let MockDocStoreApi, MockDocUpdaterApi
|
||||
|
|
@ -9,9 +9,8 @@
|
|||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const { assert, expect } = require('chai')
|
||||
const async = require('async')
|
||||
const request = require('./helpers/request')
|
||||
import { expect } from 'chai'
|
||||
import request from './helpers/request.js'
|
||||
|
||||
const assertRedirect = (method, path, expectedStatusCode, destination, cb) =>
|
||||
request[method](path, (error, response) => {
|
|
@ -1,9 +1,9 @@
|
|||
const { exec } = require('child_process')
|
||||
const { promisify } = require('util')
|
||||
const { expect } = require('chai')
|
||||
const logger = require('@overleaf/logger')
|
||||
const { filterOutput } = require('./helpers/settings')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
import { exec } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import { expect } from 'chai'
|
||||
import logger from '@overleaf/logger'
|
||||
import { filterOutput } from './helpers/settings.mjs'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
|
||||
const BATCH_SIZE = 100
|
||||
let n = 0
|
|
@ -1,10 +1,11 @@
|
|||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const metrics = require('./helpers/metrics')
|
||||
const User = require('./helpers/User')
|
||||
const UserPromises = require('./helpers/User').promises
|
||||
const redis = require('./helpers/redis')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
import { expect } from 'chai'
|
||||
import async from 'async'
|
||||
import metrics from './helpers/metrics.js'
|
||||
import User from './helpers/User.js'
|
||||
import redis from './helpers/redis.mjs'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
|
||||
const UserPromises = User.promises
|
||||
|
||||
// Expectations
|
||||
const expectProjectAccess = function (user, projectId, callback) {
|
|
@ -1,8 +1,8 @@
|
|||
const { db, ObjectId } = require('../../../app/src/infrastructure/mongodb')
|
||||
const { promisify } = require('util')
|
||||
const { exec } = require('child_process')
|
||||
const logger = require('@overleaf/logger/logging-manager')
|
||||
const { expect } = require('chai')
|
||||
import { db, ObjectId } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import { promisify } from 'util'
|
||||
import { exec } from 'child_process'
|
||||
import logger from '@overleaf/logger'
|
||||
import { expect } from 'chai'
|
||||
|
||||
describe('RemoveDeletedUsersFromTokenAccessRefsTests', function () {
|
||||
const userId1 = new ObjectId()
|
|
@ -11,11 +11,12 @@
|
|||
* DS207: Consider shorter variations of null checks
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const { assert } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
const request = require('./helpers/request')
|
||||
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter')
|
||||
import { assert } from 'chai'
|
||||
|
||||
import async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
import request from './helpers/request.js'
|
||||
import ProjectGetter from '../../../app/src/Features/Project/ProjectGetter.js'
|
||||
|
||||
const assertHasCommonHeaders = function (response) {
|
||||
const { headers } = response
|
|
@ -1,10 +1,14 @@
|
|||
const { expect } = require('chai')
|
||||
const fs = require('fs')
|
||||
const Path = require('path')
|
||||
const fetch = require('node-fetch')
|
||||
const UserHelper = require('./helpers/UserHelper')
|
||||
import { expect } from 'chai'
|
||||
import fs from 'fs'
|
||||
import Path from 'path'
|
||||
import fetch from 'node-fetch'
|
||||
import UserHelper from './helpers/UserHelper.js'
|
||||
import glob from 'glob'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
const BASE_URL = UserHelper.baseUrl()
|
||||
const glob = require('glob')
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url))
|
||||
|
||||
// Test all files in the crash_test_urls directory
|
||||
const CRASH_TEST_FILES = glob.sync(
|
|
@ -1,15 +1,15 @@
|
|||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
const redis = require('./helpers/redis')
|
||||
const UserSessionsRedis = require('../../../app/src/Features/User/UserSessionsRedis')
|
||||
import { expect } from 'chai'
|
||||
import async from 'async'
|
||||
import UserHelper from './helpers/User.js'
|
||||
import redis from './helpers/redis.mjs'
|
||||
import UserSessionsRedis from '../../../app/src/Features/User/UserSessionsRedis.js'
|
||||
const rclient = UserSessionsRedis.client()
|
||||
|
||||
describe('Sessions', function () {
|
||||
beforeEach(function (done) {
|
||||
this.timeout(20000)
|
||||
this.user1 = new User()
|
||||
this.site_admin = new User({ email: 'admin@example.com' })
|
||||
this.user1 = new UserHelper()
|
||||
this.site_admin = new UserHelper({ email: 'admin@example.com' })
|
||||
async.series(
|
||||
[cb => this.user1.login(cb), cb => this.user1.logout(cb)],
|
||||
done
|
||||
|
@ -73,7 +73,7 @@ describe('Sessions', function () {
|
|||
describe('two sessions', function () {
|
||||
beforeEach(function () {
|
||||
// set up second session for this user
|
||||
this.user2 = new User()
|
||||
this.user2 = new UserHelper()
|
||||
this.user2.email = this.user1.email
|
||||
this.user2.emails = this.user1.emails
|
||||
this.user2.password = this.user1.password
|
||||
|
@ -198,11 +198,11 @@ describe('Sessions', function () {
|
|||
describe('three sessions, password reset', function () {
|
||||
beforeEach(function () {
|
||||
// set up second session for this user
|
||||
this.user2 = new User()
|
||||
this.user2 = new UserHelper()
|
||||
this.user2.email = this.user1.email
|
||||
this.user2.emails = this.user1.emails
|
||||
this.user2.password = this.user1.password
|
||||
this.user3 = new User()
|
||||
this.user3 = new UserHelper()
|
||||
this.user3.email = this.user1.email
|
||||
this.user3.emails = this.user1.emails
|
||||
this.user3.password = this.user1.password
|
||||
|
@ -324,11 +324,11 @@ describe('Sessions', function () {
|
|||
describe('three sessions, sessions page', function () {
|
||||
beforeEach(function (done) {
|
||||
// set up second session for this user
|
||||
this.user2 = new User()
|
||||
this.user2 = new UserHelper()
|
||||
this.user2.email = this.user1.email
|
||||
this.user2.emails = this.user1.emails
|
||||
this.user2.password = this.user1.password
|
||||
this.user3 = new User()
|
||||
this.user3 = new UserHelper()
|
||||
this.user3.email = this.user1.email
|
||||
this.user3.emails = this.user1.emails
|
||||
this.user3.password = this.user1.password
|
||||
|
@ -485,7 +485,7 @@ describe('Sessions', function () {
|
|||
})
|
||||
|
||||
describe('validationToken', function () {
|
||||
const User = require('./helpers/User').promises
|
||||
const User = UserHelper.promises
|
||||
|
||||
async function tryWithValidationToken(validationToken) {
|
||||
const user = new User()
|
|
@ -8,10 +8,11 @@
|
|||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
import { expect } from 'chai'
|
||||
|
||||
import async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
|
||||
describe('SettingsPage', function () {
|
||||
beforeEach(function (done) {
|
|
@ -1,5 +1,7 @@
|
|||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User').promises
|
||||
import { expect } from 'chai'
|
||||
import UserHelper from './helpers/User.js'
|
||||
|
||||
const User = UserHelper.promises
|
||||
|
||||
describe('Sharing', function () {
|
||||
beforeEach(async function () {
|
|
@ -1,10 +1,9 @@
|
|||
const User = require('./helpers/User')
|
||||
const async = require('async')
|
||||
const { expect } = require('chai')
|
||||
const _ = require('lodash')
|
||||
const request = require('./helpers/request')
|
||||
|
||||
const expectErrorResponse = require('./helpers/expectErrorResponse')
|
||||
import User from './helpers/User.js'
|
||||
import async from 'async'
|
||||
import { expect } from 'chai'
|
||||
import _ from 'lodash'
|
||||
import request from './helpers/request.js'
|
||||
import expectErrorResponse from './helpers/expectErrorResponse.js'
|
||||
|
||||
const _initUser = (user, callback) => {
|
||||
async.series([cb => user.login(cb), cb => user.getCsrfToken(cb)], callback)
|
|
@ -1,12 +1,12 @@
|
|||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
const request = require('./helpers/request')
|
||||
const settings = require('@overleaf/settings')
|
||||
const { db } = require('../../../app/src/infrastructure/mongodb')
|
||||
const expectErrorResponse = require('./helpers/expectErrorResponse')
|
||||
const SplitTestHandler = require('../../../app/src/Features/SplitTests/SplitTestHandler')
|
||||
const sinon = require('sinon')
|
||||
import { expect } from 'chai'
|
||||
import async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
import request from './helpers/request.js'
|
||||
import settings from '@overleaf/settings'
|
||||
import { db } from '../../../app/src/infrastructure/mongodb.js'
|
||||
import expectErrorResponse from './helpers/expectErrorResponse.js'
|
||||
import SplitTestHandler from '../../../app/src/Features/SplitTests/SplitTestHandler.js'
|
||||
import sinon from 'sinon'
|
||||
|
||||
const tryEditorAccess = (user, projectId, test, callback) =>
|
||||
async.series(
|
|
@ -1,7 +1,7 @@
|
|||
const { expect } = require('chai')
|
||||
const ProjectGetter = require('../../../app/src/Features/Project/ProjectGetter')
|
||||
const request = require('./helpers/request')
|
||||
const User = require('./helpers/User')
|
||||
import { expect } from 'chai'
|
||||
import ProjectGetter from '../../../app/src/Features/Project/ProjectGetter.js'
|
||||
import request from './helpers/request.js'
|
||||
import User from './helpers/User.js'
|
||||
|
||||
describe('TpdsUpdateTests', function () {
|
||||
beforeEach(function (done) {
|
|
@ -1,5 +1,5 @@
|
|||
const { expect } = require('chai')
|
||||
const User = require('./helpers/User')
|
||||
import { expect } from 'chai'
|
||||
import User from './helpers/User.js'
|
||||
|
||||
const botUserAgents = new Map([
|
||||
[
|
|
@ -1,7 +1,7 @@
|
|||
const AuthenticationManager = require('../../../app/src/Features/Authentication/AuthenticationManager')
|
||||
const UserHelper = require('./helpers/UserHelper')
|
||||
const Features = require('../../../app/src/infrastructure/Features')
|
||||
const { expect } = require('chai')
|
||||
import AuthenticationManager from '../../../app/src/Features/Authentication/AuthenticationManager.js'
|
||||
import UserHelper from './helpers/UserHelper.js'
|
||||
import Features from '../../../app/src/infrastructure/Features.js'
|
||||
import { expect } from 'chai'
|
||||
|
||||
describe('UserHelper', function () {
|
||||
// Disable all tests unless the registration feature is enabled
|
|
@ -1,9 +1,9 @@
|
|||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
const Institution = require('./helpers/Institution')
|
||||
const Subscription = require('./helpers/Subscription')
|
||||
const Publisher = require('./helpers/Publisher')
|
||||
import { expect } from 'chai'
|
||||
import async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
import Institution from './helpers/Institution.js'
|
||||
import Subscription from './helpers/Subscription.js'
|
||||
import Publisher from './helpers/Publisher.js'
|
||||
|
||||
describe('UserMembershipAuthorization', function () {
|
||||
beforeEach(function (done) {
|
|
@ -11,9 +11,10 @@
|
|||
* DS207: Consider shorter variations of null checks
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const { expect } = require('chai')
|
||||
const async = require('async')
|
||||
const User = require('./helpers/User')
|
||||
import { expect } from 'chai'
|
||||
|
||||
import async from 'async'
|
||||
import User from './helpers/User.js'
|
||||
|
||||
describe('User Must Reconfirm', function () {
|
||||
beforeEach(function (done) {
|
|
@ -1,10 +1,8 @@
|
|||
const { expect } = require('chai')
|
||||
const MockSubscription = require('./Subscription')
|
||||
const SubscriptionUpdater = require('../../../../app/src/Features/Subscription/SubscriptionUpdater')
|
||||
const SubscriptionModel =
|
||||
require('../../../../app/src/models/Subscription').Subscription
|
||||
const DeletedSubscriptionModel =
|
||||
require('../../../../app/src/models/DeletedSubscription').DeletedSubscription
|
||||
import { expect } from 'chai'
|
||||
import MockSubscription from './Subscription.js'
|
||||
import SubscriptionUpdater from '../../../../app/src/Features/Subscription/SubscriptionUpdater.js'
|
||||
import { Subscription as SubscriptionModel } from '../../../../app/src/models/Subscription.js'
|
||||
import { DeletedSubscription as DeletedSubscriptionModel } from '../../../../app/src/models/DeletedSubscription.js'
|
||||
|
||||
class DeletedSubscription {
|
||||
constructor(options = {}) {
|
||||
|
@ -43,4 +41,4 @@ class DeletedSubscription {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = DeletedSubscription
|
||||
export default DeletedSubscription
|
|
@ -1,13 +1,13 @@
|
|||
import App from '../../../../app.mjs'
|
||||
import QueueWorkers from '../../../../app/src/infrastructure/QueueWorkers.js'
|
||||
import MongoHelper from './MongoHelper.js'
|
||||
import RedisHelper from './RedisHelper.js'
|
||||
import MongoHelper from './MongoHelper.mjs'
|
||||
import RedisHelper from './RedisHelper.mjs'
|
||||
import logger from '@overleaf/logger'
|
||||
import Settings from '@overleaf/settings'
|
||||
import MockReCAPTCHAApi from '../mocks/MockReCaptchaApi.js'
|
||||
import MockReCAPTCHAApi from '../mocks/MockReCaptchaApi.mjs'
|
||||
import { gracefulShutdown } from '../../../../app/src/infrastructure/GracefulShutdown.js'
|
||||
import Server from '../../../../app/src/infrastructure/Server.mjs'
|
||||
import { injectRouteAfter } from './injectRoute.js'
|
||||
import { injectRouteAfter } from './injectRoute.mjs'
|
||||
import SplitTestHandler from '../../../../app/src/Features/SplitTests/SplitTestHandler.js'
|
||||
import SplitTestSessionHandler from '../../../../app/src/Features/SplitTests/SplitTestSessionHandler.js'
|
||||
import Modules from '../../../../app/src/infrastructure/Modules.js'
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
const { execFile } = require('child_process')
|
||||
const {
|
||||
import { execFile } from 'child_process'
|
||||
import {
|
||||
waitForDb,
|
||||
db,
|
||||
dropTestDatabase,
|
||||
} = require('../../../../app/src/infrastructure/mongodb')
|
||||
const Settings = require('@overleaf/settings')
|
||||
} from '../../../../app/src/infrastructure/mongodb.js'
|
||||
import Settings from '@overleaf/settings'
|
||||
|
||||
const DEFAULT_ENV = 'saas'
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
initialize() {
|
||||
before('wait for db', waitForDb)
|
||||
if (process.env.CLEANUP_MONGO === 'true') {
|
|
@ -1,7 +1,7 @@
|
|||
const RedisWrapper = require('../../../../app/src/infrastructure/RedisWrapper')
|
||||
import RedisWrapper from '../../../../app/src/infrastructure/RedisWrapper.js'
|
||||
const client = RedisWrapper.client('ratelimiter')
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
initialize() {
|
||||
beforeEach('clear redis', function (done) {
|
||||
client.flushdb(done)
|
|
@ -6,7 +6,7 @@
|
|||
* @param searchFilter - a filter function to locate a route to position the new route immediatley after.
|
||||
* @param addRouteCallback - a callback that takes a router and creates the new route.
|
||||
*/
|
||||
function injectRouteAfter(app, searchFilter, addRouteCallback) {
|
||||
export function injectRouteAfter(app, searchFilter, addRouteCallback) {
|
||||
const stack = app._router.stack
|
||||
|
||||
stack.forEach(layer => {
|
||||
|
@ -36,4 +36,4 @@ function injectRouteAfter(app, searchFilter, addRouteCallback) {
|
|||
})
|
||||
}
|
||||
|
||||
module.exports = { injectRouteAfter }
|
||||
export default { injectRouteAfter }
|
|
@ -11,16 +11,16 @@
|
|||
* DS207: Consider shorter variations of null checks
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const Settings = require('@overleaf/settings')
|
||||
const logger = require('@overleaf/logger')
|
||||
const Async = require('async')
|
||||
import Settings from '@overleaf/settings'
|
||||
|
||||
const UserSessionsRedis = require('../../../../app/src/Features/User/UserSessionsRedis')
|
||||
import logger from '@overleaf/logger'
|
||||
import Async from 'async'
|
||||
import UserSessionsRedis from '../../../../app/src/Features/User/UserSessionsRedis.js'
|
||||
|
||||
// rclient = redis.createClient(Settings.redis.web)
|
||||
const rclient = UserSessionsRedis.client()
|
||||
|
||||
module.exports = {
|
||||
export default {
|
||||
getUserSessions(user, callback) {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
|
@ -1,4 +1,4 @@
|
|||
function filterOutput(line) {
|
||||
export function filterOutput(line) {
|
||||
return (
|
||||
!line.startsWith('Using settings from ') &&
|
||||
!line.startsWith('Using default settings from ') &&
|
||||
|
@ -7,4 +7,4 @@ function filterOutput(line) {
|
|||
)
|
||||
}
|
||||
|
||||
module.exports = { filterOutput }
|
||||
export default { filterOutput }
|
|
@ -1,4 +1,4 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
|
||||
class MockAnalyticsApi extends AbstractMockApi {
|
||||
reset() {
|
||||
|
@ -30,7 +30,7 @@ class MockAnalyticsApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockAnalyticsApi
|
||||
export default MockAnalyticsApi
|
||||
|
||||
// type hint for the inherited `instance` method
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
|
||||
class MockChatApi extends AbstractMockApi {
|
||||
reset() {
|
||||
|
@ -41,7 +41,7 @@ class MockChatApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockChatApi
|
||||
export default MockChatApi
|
||||
|
||||
// type hint for the inherited `instance` method
|
||||
/**
|
|
@ -1,7 +1,5 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
const {
|
||||
plainTextResponse,
|
||||
} = require('../../../../app/src/infrastructure/Response')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
import { plainTextResponse } from '../../../../app/src/infrastructure/Response.js'
|
||||
|
||||
class MockClsiApi extends AbstractMockApi {
|
||||
static compile(req, res) {
|
||||
|
@ -61,7 +59,7 @@ class MockClsiApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockClsiApi
|
||||
export default MockClsiApi
|
||||
|
||||
// type hint for the inherited `instance` method
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
|
||||
class MockGitBridgeApi extends AbstractMockApi {
|
||||
reset() {
|
||||
|
@ -18,4 +18,4 @@ class MockGitBridgeApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockGitBridgeApi
|
||||
export default MockGitBridgeApi
|
|
@ -1,7 +1,5 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
const {
|
||||
plainTextResponse,
|
||||
} = require('../../../../app/src/infrastructure/Response')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
import { plainTextResponse } from '../../../../app/src/infrastructure/Response.js'
|
||||
|
||||
class MockHaveIBeenPwnedApi extends AbstractMockApi {
|
||||
reset() {
|
||||
|
@ -42,7 +40,7 @@ class MockHaveIBeenPwnedApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockHaveIBeenPwnedApi
|
||||
export default MockHaveIBeenPwnedApi
|
||||
|
||||
// type hint for the inherited `instance` method
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
|
||||
// Currently there is nothing implemented here as we have no acceptance tests
|
||||
// for the notifications API. This does however stop errors appearing in the
|
||||
|
@ -11,7 +11,7 @@ class MockNotificationsApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockNotificationsApi
|
||||
export default MockNotificationsApi
|
||||
|
||||
// type hint for the inherited `instance` method
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
|
||||
class MockReCaptchaApi extends AbstractMockApi {
|
||||
applyRoutes() {
|
||||
|
@ -10,7 +10,7 @@ class MockReCaptchaApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockReCaptchaApi
|
||||
export default MockReCaptchaApi
|
||||
|
||||
// type hint for the inherited `instance` method
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
|
||||
class MockSpellingApi extends AbstractMockApi {
|
||||
reset() {
|
||||
|
@ -44,7 +44,7 @@ class MockSpellingApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockSpellingApi
|
||||
export default MockSpellingApi
|
||||
|
||||
// type hint for the inherited `instance` method
|
||||
/**
|
|
@ -1,4 +1,4 @@
|
|||
const AbstractMockApi = require('./AbstractMockApi')
|
||||
import AbstractMockApi from './AbstractMockApi.js'
|
||||
|
||||
class MockThirdPartyDataStoreApi extends AbstractMockApi {
|
||||
reset() {}
|
||||
|
@ -19,7 +19,7 @@ class MockThirdPartyDataStoreApi extends AbstractMockApi {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = MockThirdPartyDataStoreApi
|
||||
export default MockThirdPartyDataStoreApi
|
||||
|
||||
// type hint for the inherited `instance` method
|
||||
/**
|
Loading…
Reference in a new issue