mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-17 23:45:29 -05:00
test: relocate notification test
This commit is contained in:
parent
e7400cef71
commit
596c727a35
3 changed files with 19 additions and 19 deletions
|
@ -1,16 +1,16 @@
|
|||
// @flow
|
||||
|
||||
import {parseConfigurationFile} from '../__helper';
|
||||
import {parseConfigFile} from '../../../src/lib/utils';
|
||||
import {notify} from '../../../src/lib/notify';
|
||||
import {parseConfigurationFile} from '../../__helper';
|
||||
import {parseConfigFile} from '../../../../src/lib/utils';
|
||||
import {notify} from '../../../../src/lib/notify';
|
||||
|
||||
import {notifyRequest} from '../../../src/lib/notify/notify-request';
|
||||
import {notifyRequest} from '../../../../src/lib/notify/notify-request';
|
||||
|
||||
jest.mock('./../../../src/lib/notify/notify-request', () => ({
|
||||
jest.mock('./../../../../src/lib/notify/notify-request', () => ({
|
||||
notifyRequest: jest.fn((options, content) => Promise.resolve([options, content]))
|
||||
}));
|
||||
|
||||
require('../../../src/lib/logger').setup([]);
|
||||
require('../../../../src/lib/logger').setup([]);
|
||||
|
||||
const parseConfigurationNotifyFile = (name) => {
|
||||
return parseConfigurationFile(`notify/${name}`);
|
||||
|
@ -21,7 +21,7 @@ const packagePatternNotificationConfig = parseConfigFile(parseConfigurationNotif
|
|||
const multiNotificationConfig = parseConfigFile(parseConfigurationNotifyFile('multiple.notify'));
|
||||
|
||||
|
||||
describe('Notify', () => {
|
||||
describe('Notifications:: Notify', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
|
@ -2,7 +2,7 @@
|
|||
* @prettier
|
||||
*/
|
||||
|
||||
import { HTTP_STATUS, API_ERROR } from '../../../src/lib/constants';
|
||||
import { HTTP_STATUS, API_ERROR } from '../../../../src/lib/constants';
|
||||
|
||||
/**
|
||||
* Mocks Logger Service
|
||||
|
@ -14,7 +14,7 @@ const logger = {
|
|||
info: jest.fn(),
|
||||
},
|
||||
};
|
||||
jest.doMock('../../../src/lib/logger', () => logger);
|
||||
jest.doMock('../../../../src/lib/logger', () => logger);
|
||||
|
||||
/**
|
||||
* Test Data
|
||||
|
@ -24,7 +24,7 @@ const options = {
|
|||
};
|
||||
const content = 'Verdaccio@x.x.x successfully published';
|
||||
|
||||
describe('notifyRequest', () => {
|
||||
describe('Notifications:: notifyRequest', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
});
|
||||
|
@ -40,7 +40,7 @@ describe('notifyRequest', () => {
|
|||
resolver(error, response);
|
||||
});
|
||||
|
||||
const notification = require('../../../src/lib/notify/notify-request');
|
||||
const notification = require('../../../../src/lib/notify/notify-request');
|
||||
const args = [{ errorMessage: 'bad data' }, 'notify service has thrown an error: @{errorMessage}'];
|
||||
|
||||
await expect(notification.notifyRequest(options, content)).rejects.toEqual(API_ERROR.BAD_DATA);
|
||||
|
@ -57,7 +57,7 @@ describe('notifyRequest', () => {
|
|||
resolver(null, response);
|
||||
});
|
||||
|
||||
const notification = require('../../../src/lib/notify/notify-request');
|
||||
const notification = require('../../../../src/lib/notify/notify-request');
|
||||
const args = [{ errorMessage: 'bad data' }, 'notify service has thrown an error: @{errorMessage}'];
|
||||
|
||||
await expect(notification.notifyRequest(options, content)).rejects.toEqual(API_ERROR.BAD_DATA);
|
||||
|
@ -74,7 +74,7 @@ describe('notifyRequest', () => {
|
|||
resolver(null, response, response.body);
|
||||
});
|
||||
|
||||
const notification = require('../../../src/lib/notify/notify-request');
|
||||
const notification = require('../../../../src/lib/notify/notify-request');
|
||||
const infoArgs = [{ content }, 'A notification has been shipped: @{content}'];
|
||||
const debugArgs = [{ body: 'Successfully delivered' }, ' body: @{body}'];
|
||||
|
||||
|
@ -92,7 +92,7 @@ describe('notifyRequest', () => {
|
|||
resolver(null, response);
|
||||
});
|
||||
|
||||
const notification = require('../../../src/lib/notify/notify-request');
|
||||
const notification = require('../../../../src/lib/notify/notify-request');
|
||||
const infoArgs = [{ content }, 'A notification has been shipped: @{content}'];
|
||||
|
||||
await expect(notification.notifyRequest(options, content)).rejects.toThrow('body is missing');
|
|
@ -1,7 +1,7 @@
|
|||
import ProxyStorage from '../../../src/lib/up-storage';
|
||||
import {ERROR_CODE, TOKEN_BASIC, TOKEN_BEARER, DEFAULT_REGISTRY, HEADERS} from "../../../src/lib/constants";
|
||||
import {buildToken} from "../../../src/lib/utils";
|
||||
import {setup} from '../../../src/lib/logger';
|
||||
import ProxyStorage from '../../../../src/lib/up-storage';
|
||||
import {ERROR_CODE, TOKEN_BASIC, TOKEN_BEARER, DEFAULT_REGISTRY, HEADERS} from "../../../../src/lib/constants";
|
||||
import {buildToken} from "../../../../src/lib/utils";
|
||||
import {setup} from '../../../../src/lib/logger';
|
||||
|
||||
setup([]);
|
||||
|
||||
|
@ -22,7 +22,7 @@ function setHeaders(config, headers) {
|
|||
});
|
||||
}
|
||||
|
||||
describe('uplink auth test', () => {
|
||||
describe('uplink headers auth test', () => {
|
||||
|
||||
test('if set headers empty should return default headers', () => {
|
||||
const headers = setHeaders();
|
Loading…
Add table
Reference in a new issue