mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-20 22:52:46 -05:00
test: add unit test for up-storage
This commit is contained in:
parent
e14927afe5
commit
9d82eb8820
2 changed files with 38 additions and 2 deletions
|
@ -1,5 +1,3 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
const JSONStream = require('JSONStream');
|
const JSONStream = require('JSONStream');
|
||||||
const createError = require('http-errors');
|
const createError = require('http-errors');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
38
test/unit/up-storage.spec.js
Normal file
38
test/unit/up-storage.spec.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// @flow
|
||||||
|
import ProxyStorage from '../../src/lib/up-storage';
|
||||||
|
import AppConfig from '../../src/lib/config';
|
||||||
|
import _ from 'lodash';
|
||||||
|
// $FlowFixMe
|
||||||
|
import configExample from './partials/config';
|
||||||
|
import {setup} from '../../src/lib/logger';
|
||||||
|
|
||||||
|
setup([]);
|
||||||
|
|
||||||
|
describe('UpStorge', () => {
|
||||||
|
|
||||||
|
const uplinkDefault = {
|
||||||
|
url: 'https://registry.npmjs.org/'
|
||||||
|
};
|
||||||
|
let generateProxy = (config = uplinkDefault) => {
|
||||||
|
const appConfig: Config = new AppConfig(configExample);
|
||||||
|
// config.self_path = path.join('../partials/store');
|
||||||
|
|
||||||
|
return new ProxyStorage(config, appConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
test('should be defined', () => {
|
||||||
|
const proxy = generateProxy();
|
||||||
|
expect(proxy).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should be get remote metadata', (done) => {
|
||||||
|
const proxy = generateProxy();
|
||||||
|
proxy.getRemoteMetadata('jquery', {}, (err, data, etag) => {
|
||||||
|
expect(err).toBeNull();
|
||||||
|
expect(_.isString(etag)).toBeTruthy();
|
||||||
|
expect(data.name).toBe('jquery');
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
Loading…
Add table
Reference in a new issue