mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
1810ed0d81
* feat:Environment variables support in configuration file * add changeset * remove fixes typo Co-authored-by: amit <amit@enso.security>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { parseConfigFile } from '../src';
|
|
import { parseConfigurationFile } from './utils';
|
|
|
|
describe('Package access utilities', () => {
|
|
describe('JSON format', () => {
|
|
test('parse default.json', () => {
|
|
const config = parseConfigFile(parseConfigurationFile('default.json'));
|
|
|
|
expect(config.storage).toBeDefined();
|
|
});
|
|
|
|
test('parse invalid.json', () => {
|
|
expect(function () {
|
|
parseConfigFile(parseConfigurationFile('invalid.json'));
|
|
}).toThrow(/Error/);
|
|
});
|
|
|
|
test('parse not-exists.json', () => {
|
|
expect(function () {
|
|
parseConfigFile(parseConfigurationFile('not-exists.json'));
|
|
}).toThrow(/Error/);
|
|
});
|
|
});
|
|
|
|
describe('JavaScript format', () => {
|
|
test('parse default.js', () => {
|
|
const config = parseConfigFile(parseConfigurationFile('default.js'));
|
|
|
|
expect(config.storage).toBeDefined();
|
|
});
|
|
|
|
test('parse invalid.js', () => {
|
|
expect(function () {
|
|
parseConfigFile(parseConfigurationFile('invalid.js'));
|
|
}).toThrow(/Error/);
|
|
});
|
|
|
|
test('parse not-exists.js', () => {
|
|
expect(function () {
|
|
parseConfigFile(parseConfigurationFile('not-exists.js'));
|
|
}).toThrow(/Error/);
|
|
});
|
|
});
|
|
});
|