diff --git a/src/webui/utils/url.js b/src/webui/utils/url.js
index 1846ea62d..534687020 100644
--- a/src/webui/utils/url.js
+++ b/src/webui/utils/url.js
@@ -8,5 +8,5 @@ export function getRegistryURL() {
* @param {string} packageName
*/
export function getDetailPageURL(packageName) {
- return `${getRegistryURL()}/#/detail/${packageName}`;
+ return `${getRegistryURL()}/-/web/version/${packageName}`;
}
diff --git a/test/unit/webui/components/PackageSidebar/__snapshots__/dependencies.spec.js.snap b/test/unit/webui/components/PackageSidebar/__snapshots__/dependencies.spec.js.snap
index 6aa51c534..0e00f4e9b 100644
--- a/test/unit/webui/components/PackageSidebar/__snapshots__/dependencies.spec.js.snap
+++ b/test/unit/webui/components/PackageSidebar/__snapshots__/dependencies.spec.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[` : should load dependencies 1`] = `"
Dependencies
- @verdaccio/file-locking,
- @verdaccio/streams,
- JSONStream,
- apache-md5,
- async,
- body-parser,
- bunyan,
- chalk,
- commander,
- compression,
- cookies,
- cors,
- express,
- global,
- handlebars,
- http-errors,
- js-string-escape,
- js-yaml,
- jsonwebtoken,
- lockfile,
- lodash,
- lunr,
- marked,
- mime,
- minimatch,
- mkdirp,
- pkginfo,
- request,
- semver,
- unix-crypt-td-js
"`;
+exports[` : should load dependencies 1`] = `"Dependencies
- @verdaccio/file-locking,
- @verdaccio/streams,
- JSONStream,
- apache-md5,
- async,
- body-parser,
- bunyan,
- chalk,
- commander,
- compression,
- cookies,
- cors,
- express,
- global,
- handlebars,
- http-errors,
- js-string-escape,
- js-yaml,
- jsonwebtoken,
- lockfile,
- lodash,
- lunr,
- marked,
- mime,
- minimatch,
- mkdirp,
- pkginfo,
- request,
- semver,
- unix-crypt-td-js
"`;
exports[` : should load the package without dependencies 1`] = `""`;
diff --git a/test/unit/webui/components/PackageSidebar/__snapshots__/peerDependencies.spec.js.snap b/test/unit/webui/components/PackageSidebar/__snapshots__/peerDependencies.spec.js.snap
index 2eba77ddf..7baa15a47 100644
--- a/test/unit/webui/components/PackageSidebar/__snapshots__/peerDependencies.spec.js.snap
+++ b/test/unit/webui/components/PackageSidebar/__snapshots__/peerDependencies.spec.js.snap
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[` : should load dependencies 1`] = `"Peer Dependencies
- @verdaccio/file-locking,
- @verdaccio/streams,
- JSONStream,
- apache-md5,
- async,
- body-parser,
- bunyan,
- chalk,
- commander,
- compression,
- cookies,
- cors,
- express,
- global,
- handlebars,
- http-errors,
- js-string-escape,
- js-yaml,
- jsonwebtoken,
- lockfile,
- lodash,
- lunr,
- marked,
- mime,
- minimatch,
- mkdirp,
- pkginfo,
- request,
- semver,
- unix-crypt-td-js
"`;
+exports[` : should load dependencies 1`] = `"Peer Dependencies
- @verdaccio/file-locking,
- @verdaccio/streams,
- JSONStream,
- apache-md5,
- async,
- body-parser,
- bunyan,
- chalk,
- commander,
- compression,
- cookies,
- cors,
- express,
- global,
- handlebars,
- http-errors,
- js-string-escape,
- js-yaml,
- jsonwebtoken,
- lockfile,
- lodash,
- lunr,
- marked,
- mime,
- minimatch,
- mkdirp,
- pkginfo,
- request,
- semver,
- unix-crypt-td-js
"`;
exports[` : should load the package without dependencies 1`] = `""`;
diff --git a/test/unit/webui/components/__snapshots__/header.spec.js.snap b/test/unit/webui/components/__snapshots__/header.spec.js.snap
index 924bca4ba..cfa5df1eb 100644
--- a/test/unit/webui/components/__snapshots__/header.spec.js.snap
+++ b/test/unit/webui/components/__snapshots__/header.spec.js.snap
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[` component with logged in state should load the component in logged in state 1`] = `""`;
+exports[` component with logged in state should load the component in logged in state 1`] = `""`;
-exports[` component with logged out state should load the component in logged out state 1`] = `""`;
+exports[` component with logged out state should load the component in logged out state 1`] = `""`;
diff --git a/test/unit/webui/components/header.spec.js b/test/unit/webui/components/header.spec.js
index 8d1ee6eae..de6b602cc 100644
--- a/test/unit/webui/components/header.spec.js
+++ b/test/unit/webui/components/header.spec.js
@@ -4,11 +4,14 @@
*/
import React from 'react';
-import { mount } from 'enzyme';
+import { BrowserRouter as Router } from 'react-router-dom';
+import { shallow } from 'enzyme';
import Header from '../../../../src/webui/components/Header';
describe(' component with logged in state', () => {
let wrapper;
+ let routerWrapper;
+ let instance;
let props;
beforeEach(() => {
@@ -19,7 +22,13 @@ describe(' component with logged in state', () => {
scope: 'test scope',
withoutSearch: true,
};
- wrapper = mount();
+ routerWrapper = shallow(
+
+
+
+ );
+ wrapper = routerWrapper.find(Header).dive();
+ instance = wrapper.instance();
});
test('should load the component in logged in state', () => {
@@ -29,13 +38,12 @@ describe(' component with logged in state', () => {
registryUrl: 'http://localhost',
showMobileNavBar: false,
};
+
expect(wrapper.state()).toEqual(state);
- expect(wrapper.html()).toMatchSnapshot();
+ expect(routerWrapper.html()).toMatchSnapshot();
});
test('handleLoggedInMenu: set anchorEl to html element value in state', () => {
- const { handleLoggedInMenu } = wrapper.instance();
-
// creates a sample menu
const div = document.createElement('div');
const text = document.createTextNode('sample menu');
@@ -45,13 +53,15 @@ describe(' component with logged in state', () => {
currentTarget: div,
};
- handleLoggedInMenu(event);
+ instance.handleLoggedInMenu(event);
expect(wrapper.state('anchorEl')).toEqual(div);
});
});
describe(' component with logged out state', () => {
let wrapper;
+ let routerWrapper;
+ let instance;
let props;
beforeEach(() => {
@@ -61,7 +71,13 @@ describe(' component with logged out state', () => {
scope: 'test scope',
withoutSearch: true,
};
- wrapper = mount();
+ routerWrapper = shallow(
+
+
+
+ );
+ wrapper = routerWrapper.find(Header).dive();
+ instance = wrapper.instance();
});
test('should load the component in logged out state', () => {
@@ -72,30 +88,26 @@ describe(' component with logged out state', () => {
showMobileNavBar: false,
};
expect(wrapper.state()).toEqual(state);
- expect(wrapper.html()).toMatchSnapshot();
+ expect(routerWrapper.html()).toMatchSnapshot();
});
test('handleLoggedInMenuClose: set anchorEl value to null in state', () => {
- const { handleLoggedInMenuClose } = wrapper.instance();
- handleLoggedInMenuClose();
+ instance.handleLoggedInMenuClose();
expect(wrapper.state('anchorEl')).toBeNull();
});
test('handleOpenRegistryInfoDialog: set openInfoDialog to be truthy in state', () => {
- const { handleOpenRegistryInfoDialog } = wrapper.instance();
- handleOpenRegistryInfoDialog();
+ instance.handleOpenRegistryInfoDialog();
expect(wrapper.state('openInfoDialog')).toBeTruthy();
});
test('handleCloseRegistryInfoDialog: set openInfoDialog to be falsy in state', () => {
- const { handleCloseRegistryInfoDialog } = wrapper.instance();
- handleCloseRegistryInfoDialog();
+ instance.handleCloseRegistryInfoDialog();
expect(wrapper.state('openInfoDialog')).toBeFalsy();
});
test('handleToggleLogin: close/open popover menu', () => {
- const { handleToggleLogin } = wrapper.instance();
- handleToggleLogin();
+ instance.handleToggleLogin();
expect(wrapper.state('anchorEl')).toBeNull();
expect(props.onToggleLoginModal).toHaveBeenCalled();
});