Skip to content

Commit

Permalink
fix Jest (to revert)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Oct 4, 2023
1 parent fbf8740 commit 8dc7c51
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 22 deletions.
8 changes: 4 additions & 4 deletions packages/@uppy/companion/test/__tests__/callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const mockOauthState = require('../mockoauthstate')()

// eslint-disable-next-line import/order
const request = require('supertest')
const tokenService = require('../../src/server/helpers/jwt')
const tokenService = require('../../lib/server/helpers/jwt')
const { getServer, grantToken } = require('../mockserver')

jest.mock('../../src/server/helpers/oauth-state', () => ({
...jest.requireActual('../../src/server/helpers/oauth-state'),
jest.mock('../../lib/server/helpers/oauth-state', () => ({
...jest.requireActual('../../lib/server/helpers/oauth-state'),
...mockOauthState,
}))

Expand Down Expand Up @@ -41,7 +41,7 @@ describe('test authentication callback', () => {
})

test('the token gets sent via html', () => {
// see mock ../../src/server/helpers/oauth-state above for state values
// see mock ../../lib/server/helpers/oauth-state above for state values
return request(authServer)
.get(`/dropbox/send-token?uppyAuthToken=${token}&state=state-with-newer-version`)
.expect(200)
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/test/__tests__/companion.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jest.mock('node:dns', () => {
}
})

const tokenService = require('../../src/server/helpers/jwt')
const tokenService = require('../../lib/server/helpers/jwt')
const { getServer } = require('../mockserver')

// todo don't share server between tests. rewrite to not use env variables
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/test/__tests__/cors.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { cors } = require('../../src/server/middlewares')
const { cors } = require('../../lib/server/middlewares')

function testWithMock ({ corsOptions, get = () => {}, origin = 'https://localhost:1234' } = {}) {
const res = {
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/test/__tests__/credentials.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const request = require('supertest')
const nock = require('nock')
const tokenService = require('../../src/server/helpers/jwt')
const tokenService = require('../../lib/server/helpers/jwt')
const { getServer } = require('../mockserver')
const { nockZoomRevoke } = require('../fixtures/zoom')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const headerSanitize = require('../../src/server/header-blacklist')
const headerSanitize = require('../../lib/server/header-blacklist')

describe('Header black-list testing', () => {
test('All headers invalid by name', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/@uppy/companion/test/__tests__/http-agent.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const nock = require('nock')
const { getRedirectEvaluator, FORBIDDEN_IP_ADDRESS, FORBIDDEN_RESOLVED_IP_ADDRESS } = require('../../src/server/helpers/request')
const { getProtectedGot } = require('../../src/server/helpers/request')
const { getRedirectEvaluator, FORBIDDEN_IP_ADDRESS, FORBIDDEN_RESOLVED_IP_ADDRESS } = require('../../lib/server/helpers/request')
const { getProtectedGot } = require('../../lib/server/helpers/request')

describe('test getRedirectEvaluator', () => {
const httpURL = 'http://uppy.io'
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/test/__tests__/logger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const chalk = require('chalk')
const logger = require('../../src/server/logger')
const logger = require('../../lib/server/logger')

const maskables = ['ToBeMasked1', 'toBeMasked2', 'toBeMasked(And)?Escaped']

Expand Down
6 changes: 3 additions & 3 deletions packages/@uppy/companion/test/__tests__/provider-manager.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const providerManager = require('../../src/server/provider')
const { getCompanionOptions } = require('../../src/standalone/helper')
const providerManager = require('../../lib/server/provider')
const { getCompanionOptions } = require('../../lib/standalone/helper')
const { setDefaultEnv } = require('../mockserver')

let grantConfig
Expand All @@ -9,7 +9,7 @@ describe('Test Provider options', () => {
beforeEach(() => {
setDefaultEnv()
// eslint-disable-next-line global-require
grantConfig = require('../../src/config/grant')()
grantConfig = require('../../lib/config/grant')()
companionOptions = getCompanionOptions()
})

Expand Down
4 changes: 2 additions & 2 deletions packages/@uppy/companion/test/__tests__/providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const { nockGoogleDownloadFile } = require('../fixtures/drive')
const { nockZoomRecordings, nockZoomRevoke, expects: { localZoomKey, localZoomSecret } } = require('../fixtures/zoom')
const defaults = require('../fixtures/constants')

const tokenService = require('../../src/server/helpers/jwt')
const tokenService = require('../../lib/server/helpers/jwt')
const { getServer } = require('../mockserver')

// todo don't share server between tests. rewrite to not use env variables
const authServer = getServer({ COMPANION_CLIENT_SOCKET_CONNECT_TIMEOUT: '0' })
const OAUTH_STATE = 'some-cool-nice-encrytpion'
const providers = require('../../src/server/provider').getDefaultProviders()
const providers = require('../../lib/server/provider').getDefaultProviders()

const providerNames = Object.keys(providers)
const AUTH_PROVIDERS = {
Expand Down
6 changes: 3 additions & 3 deletions packages/@uppy/companion/test/__tests__/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const intoStream = require('into-stream')
const fs = require('node:fs')
const nock = require('nock')

const Uploader = require('../../src/server/Uploader')
const Uploader = require('../../lib/server/Uploader')
const socketClient = require('../mocksocket')
const standalone = require('../../src/standalone')
const Emitter = require('../../src/server/emitter')
const standalone = require('../../lib/standalone')
const Emitter = require('../../lib/server/emitter')

afterAll(() => {
nock.cleanAll()
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/test/fixtures/zoom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const nock = require('nock')

const { getBasicAuthHeader } = require('../../src/server/helpers/utils')
const { getBasicAuthHeader } = require('../../lib/server/helpers/utils')

module.exports.expects = {
listPath: 'DUMMY-UUID%3D%3D',
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/test/mockserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports.getServer = (extraEnv) => {
// https://github.com/transloadit/uppy/issues/3284
jest.resetModules()
// eslint-disable-next-line global-require
const standalone = require('../src/standalone')
const standalone = require('../lib/standalone')
const authServer = express()

authServer.use(session({ secret: 'grant', resave: true, saveUninitialized: true }))
Expand Down
2 changes: 1 addition & 1 deletion packages/@uppy/companion/test/mocksocket.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const emitter = require('../src/server/emitter')
const emitter = require('../lib/server/emitter')

module.exports.connect = (uploadToken) => {
emitter().emit(`connection:${uploadToken}`)
Expand Down

0 comments on commit 8dc7c51

Please sign in to comment.