0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

test: relocate api spec test

This commit is contained in:
Juan Picado @jotadeveloper 2019-05-20 08:47:52 +02:00
parent 4bf6b3b844
commit 8786a3740e
No known key found for this signature in database
GPG key ID: 18AC54485952D158
3 changed files with 18 additions and 18 deletions

View file

@ -3,18 +3,18 @@ import _ from 'lodash';
import path from 'path'; import path from 'path';
import rimraf from 'rimraf'; import rimraf from 'rimraf';
import configDefault from '../partials/config/index'; import configDefault from '../../partials/config';
import publishMetadata from '../partials/publish-api'; import publishMetadata from '../../partials/publish-api';
import starMetadata from '../partials/star-api'; import starMetadata from '../../partials/star-api';
import endPointAPI from '../../../src/api/index'; import endPointAPI from '../../../../src/api';
import {HEADERS, API_ERROR, HTTP_STATUS, HEADER_TYPE, API_MESSAGE, TOKEN_BEARER} from '../../../src/lib/constants'; import {HEADERS, API_ERROR, HTTP_STATUS, HEADER_TYPE, API_MESSAGE, TOKEN_BEARER} from '../../../../src/lib/constants';
import {mockServer} from '../__helper/mock'; import {mockServer} from '../../__helper/mock';
import {DOMAIN_SERVERS} from '../../functional/config.functional'; import {DOMAIN_SERVERS} from '../../../functional/config.functional';
import {buildToken} from '../../../src/lib/utils'; import {buildToken} from '../../../../src/lib/utils';
import {getNewToken} from '../__helper/api'; import {getNewToken} from '../../__helper/api';
require('../../../src/lib/logger').setup([]); require('../../../../src/lib/logger').setup([]);
const credentials = { name: 'jota', password: 'secretPass' }; const credentials = { name: 'jota', password: 'secretPass' };
const putPackage = (app, name, publishMetadata) => { const putPackage = (app, name, publishMetadata) => {
@ -33,7 +33,7 @@ describe('endpoint unit test', () => {
let mockRegistry; let mockRegistry;
beforeAll(function(done) { beforeAll(function(done) {
const store = path.join(__dirname, '../store/test-storage-api-spec'); const store = path.join(__dirname, '../../partials/store/test-storage-api-spec');
const mockServerPort = 55549; const mockServerPort = 55549;
rimraf(store, async () => { rimraf(store, async () => {
const configForTest = configDefault({ const configForTest = configDefault({
@ -43,7 +43,7 @@ describe('endpoint unit test', () => {
} }
}, },
filters: { filters: {
'../partials/plugin/filter': { '../../modules/api/partials/plugin/filter': {
pkg: 'npm_test', pkg: 'npm_test',
version: '2.0.0' version: '2.0.0'
} }

View file

@ -4,7 +4,7 @@ class FilterPlugin {
} }
filter_metadata(pkg) { filter_metadata(pkg) {
return new Promise((resolve) => { return new Promise((resolve, reject) => {
// We use this to test what happens when a filter rejects // We use this to test what happens when a filter rejects
if(pkg.name === 'trigger-filter-failure') { if(pkg.name === 'trigger-filter-failure') {
reject(new Error('Example filter failure')); reject(new Error('Example filter failure'));

View file

@ -1,10 +1,10 @@
import Search from '../../../src/lib/search'; import Search from '../../../../src/lib/search';
import Config from '../../../src/lib/config'; import Config from '../../../../src/lib/config';
import Storage from '../../../src/lib/storage'; import Storage from '../../../../src/lib/storage';
import buildConfig from '../partials/config/index'; import buildConfig from '../../partials/config';
require('../../../src/lib/logger').setup([]); require('../../../../src/lib/logger').setup([]);
let packages = [ let packages = [
{ {