diff --git a/test/unit/api/__api-helper.js b/test/unit/__helper/api.js similarity index 100% rename from test/unit/api/__api-helper.js rename to test/unit/__helper/api.js diff --git a/test/unit/__helper.js b/test/unit/__helper/index.js similarity index 52% rename from test/unit/__helper.js rename to test/unit/__helper/index.js index 95b90b8c7..94426ab36 100644 --- a/test/unit/__helper.js +++ b/test/unit/__helper/index.js @@ -1,5 +1,5 @@ import path from 'path'; export const parseConfigurationFile = (name) => { - return path.join(__dirname, `./partials/config/yaml/${name}.yaml`); + return path.join(__dirname, `../partials/config/yaml/${name}.yaml`); }; diff --git a/test/unit/api/mock.js b/test/unit/__helper/mock.js similarity index 68% rename from test/unit/api/mock.js rename to test/unit/__helper/mock.js index c329be2b8..9bd6bb219 100644 --- a/test/unit/api/mock.js +++ b/test/unit/__helper/mock.js @@ -9,9 +9,11 @@ import type {IServerBridge} from '../../types'; export function mockServer(port: number) { const pathStore = path.join(__dirname, '../partials'); - const verdaccioConfig = new VerdaccioConfig( - path.join(pathStore, '/mock-store'), - path.join(pathStore, '/config-unit-mock-server-test.yaml'), `http://${DOMAIN_SERVERS}:${port}/`, port); + const storePath = path.join(pathStore, '/mock-store'); + const configPath = path.join(pathStore, '/config-unit-mock-server-test.yaml'); + + const verdaccioConfig = new VerdaccioConfig(storePath, configPath, `http://${DOMAIN_SERVERS}:${port}/`, port); + const server: IServerBridge = new Server(verdaccioConfig.domainPath); return new VerdaccioProcess(verdaccioConfig, server, false, false, false); diff --git a/test/unit/api/api.jwt.spec.js b/test/unit/api/api.jwt.spec.js index 196efc4fe..0ae6dc7b4 100644 --- a/test/unit/api/api.jwt.spec.js +++ b/test/unit/api/api.jwt.spec.js @@ -8,11 +8,11 @@ import rimraf from 'rimraf'; import endPointAPI from '../../../src/api/index'; import {HEADERS, HTTP_STATUS, HEADER_TYPE} from '../../../src/lib/constants'; -import {mockServer} from './mock'; +import {mockServer} from '../__helper/mock'; import {DOMAIN_SERVERS} from '../../functional/config.functional'; import {parseConfigFile} from '../../../src/lib/utils'; import {parseConfigurationFile} from '../__helper'; -import {addUser, getPackage} from './__api-helper'; +import {addUser, getPackage} from '../__helper/api'; import {setup} from '../../../src/lib/logger'; import {buildUserBuffer} from '../../../src/lib/auth-utils'; diff --git a/test/unit/api/api.pkg.access.spec.js b/test/unit/api/api.pkg.access.spec.js index a9c048aeb..18e3aa1eb 100644 --- a/test/unit/api/api.pkg.access.spec.js +++ b/test/unit/api/api.pkg.access.spec.js @@ -6,7 +6,7 @@ import rimraf from 'rimraf'; import { HEADERS, HTTP_STATUS } from '../../../src/lib/constants'; import configDefault from '../partials/config/config_access'; import endPointAPI from '../../../src/api/index'; -import {mockServer} from './mock'; +import {mockServer} from '../__helper/mock'; import {DOMAIN_SERVERS} from '../../functional/config.functional'; require('../../../src/lib/logger').setup([]); diff --git a/test/unit/api/api.profile.spec.js b/test/unit/api/api.profile.spec.js index 377480c0f..fff52c817 100644 --- a/test/unit/api/api.profile.spec.js +++ b/test/unit/api/api.profile.spec.js @@ -6,10 +6,10 @@ import path from 'path'; import rimraf from 'rimraf'; import endPointAPI from '../../../src/api/index'; -import {mockServer} from './mock'; +import {mockServer} from '../__helper/mock'; import {parseConfigFile} from '../../../src/lib/utils'; import {parseConfigurationFile} from '../__helper'; -import {getNewToken, getProfile, postProfile} from './__api-helper'; +import {getNewToken, getProfile, postProfile} from '../__helper/api'; import {setup} from '../../../src/lib/logger'; import {API_ERROR, HTTP_STATUS, SUPPORT_ERRORS} from '../../../src/lib/constants'; diff --git a/test/unit/api/api.spec.js b/test/unit/api/api.spec.js index 78798b749..0ecde6247 100644 --- a/test/unit/api/api.spec.js +++ b/test/unit/api/api.spec.js @@ -9,10 +9,10 @@ import starMetadata from '../partials/star-api'; import endPointAPI from '../../../src/api/index'; import {HEADERS, API_ERROR, HTTP_STATUS, HEADER_TYPE, API_MESSAGE, TOKEN_BEARER} from '../../../src/lib/constants'; -import {mockServer} from './mock'; +import {mockServer} from '../__helper/mock'; import {DOMAIN_SERVERS} from '../../functional/config.functional'; import {buildToken} from '../../../src/lib/utils'; -import {getNewToken} from './__api-helper'; +import {getNewToken} from '../__helper/api'; require('../../../src/lib/logger').setup([]); const credentials = { name: 'jota', password: 'secretPass' }; diff --git a/test/unit/api/api.web.spec.js b/test/unit/api/api.web.spec.js index b88479081..4a40a5ef6 100644 --- a/test/unit/api/api.web.spec.js +++ b/test/unit/api/api.web.spec.js @@ -9,8 +9,8 @@ import endPointAPI from '../../../src/api/index'; import { HEADERS, API_ERROR, HTTP_STATUS, HEADER_TYPE, DIST_TAGS} from '../../../src/lib/constants'; import {DOMAIN_SERVERS} from '../../functional/config.functional'; -import {mockServer} from './mock'; -import {addUser} from './__api-helper'; +import {mockServer} from '../__helper/mock'; +import {addUser} from '../__helper/api'; require('../../../src/lib/logger').setup([]); diff --git a/test/unit/api/store.spec.js b/test/unit/api/store.spec.js index 3925ef8a6..d730d74ec 100644 --- a/test/unit/api/store.spec.js +++ b/test/unit/api/store.spec.js @@ -12,7 +12,7 @@ import {setup} from '../../../src/lib/logger'; import type {Config} from '@verdaccio/types'; import type {IStorageHandler} from '../../../types/index'; import {API_ERROR, HTTP_STATUS} from '../../../src/lib/constants'; -import {mockServer} from './mock'; +import {mockServer} from '../__helper/mock'; import {DOMAIN_SERVERS} from '../../functional/config.functional'; setup([]); diff --git a/test/unit/api/up-storage.spec.js b/test/unit/api/up-storage.spec.js index 711292bce..ae4bcce10 100644 --- a/test/unit/api/up-storage.spec.js +++ b/test/unit/api/up-storage.spec.js @@ -9,7 +9,7 @@ import {setup} from '../../../src/lib/logger'; import type {Config, UpLinkConf} from '@verdaccio/types'; import type {IProxy} from '../../../types/index'; import {API_ERROR, HTTP_STATUS} from "../../../src/lib/constants"; -import {mockServer} from './mock'; +import {mockServer} from '../__helper/mock'; import {DOMAIN_SERVERS} from '../../functional/config.functional'; setup([]); diff --git a/test/unit/functionalLibs/request.spec.js b/test/unit/functionalLibs/request.spec.js index 6a62aac0a..51b76a2fc 100644 --- a/test/unit/functionalLibs/request.spec.js +++ b/test/unit/functionalLibs/request.spec.js @@ -2,7 +2,7 @@ import _ from 'lodash'; import smartRequest, {PromiseAssert} from '../../lib/request'; -import {mockServer} from '../api/mock'; +import {mockServer} from '../__helper/mock'; import {HTTP_STATUS} from '../../../src/lib/constants'; import type {IRequestPromise} from '../../types';