mirror of
https://github.com/SomboChea/ui
synced 2026-01-18 00:56:00 +07:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01daf73bbf | ||
|
|
a89f363115 | ||
|
|
c3eac3d27b | ||
|
|
9d7be476ad | ||
|
|
1070e5c3aa |
192
.github/main.workflow
vendored
192
.github/main.workflow
vendored
@@ -1,79 +1,215 @@
|
|||||||
workflow "build and test" {
|
################################################
|
||||||
|
# Workflow for a branch push
|
||||||
|
################################################
|
||||||
|
workflow "build and test on branch" {
|
||||||
resolves = [
|
resolves = [
|
||||||
"lint",
|
"branch.lint.node.10",
|
||||||
"test",
|
"branch.test.node.10",
|
||||||
"branch-filter",
|
"branch.test.node.8",
|
||||||
|
# "branch.test.node.12"
|
||||||
]
|
]
|
||||||
on = "push"
|
on = "push"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "branch-filter" {
|
# node 10
|
||||||
|
action "branch.filter" {
|
||||||
uses = "actions/bin/filter@master"
|
uses = "actions/bin/filter@master"
|
||||||
args = "branch"
|
args = "branch"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "install" {
|
action "branch.install.node.10" {
|
||||||
|
needs = ["branch.filter"]
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
args = "yarn install"
|
args = "yarn install"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "build" {
|
action "branch.build.node.10" {
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
needs = ["install"]
|
needs = ["branch.install.node.10"]
|
||||||
args = "yarn run build"
|
args = "yarn run build"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "lint" {
|
action "branch.lint.node.10" {
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
needs = ["install"]
|
needs = ["branch.install.node.10"]
|
||||||
args = "yarn run lint"
|
args = "yarn run lint"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "test" {
|
action "branch.test.node.10" {
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
needs = ["build"]
|
needs = ["branch.build.node.10"]
|
||||||
args = "yarn run test"
|
args = "yarn run test"
|
||||||
}
|
}
|
||||||
|
|
||||||
workflow "release" {
|
# node 8
|
||||||
|
action "branch.install.node.8" {
|
||||||
|
needs = ["branch.filter"]
|
||||||
|
uses = "docker://node:8"
|
||||||
|
args = "yarn install"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "branch.build.node.8" {
|
||||||
|
uses = "docker://node:8"
|
||||||
|
needs = ["branch.install.node.8"]
|
||||||
|
args = "yarn run build"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "branch.test.node.8" {
|
||||||
|
uses = "docker://node:8"
|
||||||
|
needs = ["branch.build.node.8"]
|
||||||
|
args = "yarn run test"
|
||||||
|
}
|
||||||
|
|
||||||
|
# @todo node 12
|
||||||
|
# action "branch.install.node.12" {
|
||||||
|
# needs = ["branch.filter"]
|
||||||
|
# uses = "docker://node:12"
|
||||||
|
# args = "yarn install"
|
||||||
|
# }
|
||||||
|
|
||||||
|
# action "branch.build.node.12" {
|
||||||
|
# uses = "docker://node:12"
|
||||||
|
# needs = ["branch.install.node.12"]
|
||||||
|
# args = "yarn run build"
|
||||||
|
# }
|
||||||
|
|
||||||
|
# action "branch.test.node.12" {
|
||||||
|
# uses = "docker://node:12"
|
||||||
|
# needs = ["branch.build.node.12"]
|
||||||
|
# args = "yarn run test"
|
||||||
|
# }
|
||||||
|
|
||||||
|
################################################
|
||||||
|
# Workflow for a Pull request
|
||||||
|
################################################
|
||||||
|
workflow "build and test on PR" {
|
||||||
resolves = [
|
resolves = [
|
||||||
"github-release",
|
"pr.lint.node.10",
|
||||||
"release:lint",
|
"pr.test.node.10",
|
||||||
|
"pr.test.node.8",
|
||||||
|
# "pr.test.node.12"
|
||||||
|
]
|
||||||
|
on = "pull_request"
|
||||||
|
}
|
||||||
|
|
||||||
|
# node 10
|
||||||
|
action "pr.filter" {
|
||||||
|
uses = "actions/bin/filter@master"
|
||||||
|
args = "action 'opened|synchronize|reopened'"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "pr.install.node.10" {
|
||||||
|
needs = ["pr.filter"]
|
||||||
|
uses = "docker://node:10"
|
||||||
|
args = "yarn install"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "pr.build.node.10" {
|
||||||
|
uses = "docker://node:10"
|
||||||
|
needs = ["pr.install.node.10"]
|
||||||
|
args = "yarn run build"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "pr.lint.node.10" {
|
||||||
|
uses = "docker://node:10"
|
||||||
|
needs = ["pr.install.node.10"]
|
||||||
|
args = "yarn run lint"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "pr.test.node.10" {
|
||||||
|
uses = "docker://node:10"
|
||||||
|
needs = ["pr.build.node.10"]
|
||||||
|
args = "yarn run test"
|
||||||
|
}
|
||||||
|
|
||||||
|
# node 8
|
||||||
|
action "pr.install.node.8" {
|
||||||
|
needs = ["pr.filter"]
|
||||||
|
uses = "docker://node:8"
|
||||||
|
args = "yarn install"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "pr.build.node.8" {
|
||||||
|
uses = "docker://node:8"
|
||||||
|
needs = ["pr.install.node.8"]
|
||||||
|
args = "yarn run build"
|
||||||
|
}
|
||||||
|
|
||||||
|
action "pr.test.node.8" {
|
||||||
|
uses = "docker://node:8"
|
||||||
|
needs = ["pr.build.node.8"]
|
||||||
|
args = "yarn run test"
|
||||||
|
}
|
||||||
|
|
||||||
|
# @todo node 12
|
||||||
|
# action "pr.install.node.12" {
|
||||||
|
# needs = ["pr.filter"]
|
||||||
|
# uses = "docker://node:12"
|
||||||
|
# args = "yarn install"
|
||||||
|
# }
|
||||||
|
|
||||||
|
# action "pr.build.node.12" {
|
||||||
|
# uses = "docker://node:12"
|
||||||
|
# needs = ["pr.install.node.12"]
|
||||||
|
# args = "yarn run build"
|
||||||
|
# }
|
||||||
|
|
||||||
|
# action "pr.test.node.12" {
|
||||||
|
# uses = "docker://node:12"
|
||||||
|
# needs = ["pr.build.node.12"]
|
||||||
|
# args = "yarn run test"
|
||||||
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
################################################
|
||||||
|
# Workflow for a github release when a tag is
|
||||||
|
# pushed
|
||||||
|
################################################
|
||||||
|
workflow "github release" {
|
||||||
|
resolves = [
|
||||||
|
"release.github",
|
||||||
|
"release.lint",
|
||||||
]
|
]
|
||||||
on = "push"
|
on = "push"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "release:tag-filter" {
|
action "release.filter" {
|
||||||
uses = "actions/bin/filter@master"
|
uses = "actions/bin/filter@master"
|
||||||
args = "tag v*"
|
args = "tag v*"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "release:install" {
|
action "release.install" {
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
needs = ["release:tag-filter"]
|
needs = ["release.filter"]
|
||||||
args = "yarn install"
|
args = "yarn install"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "release:build" {
|
action "release.build" {
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
needs = ["release:install"]
|
needs = ["release.install"]
|
||||||
args = "yarn run build"
|
args = "yarn run build"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "release:lint" {
|
action "release.lint" {
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
needs = ["release:install"]
|
needs = ["release.install"]
|
||||||
args = "yarn run lint"
|
args = "yarn run lint"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "release:test" {
|
action "release.test" {
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
needs = ["release:build"]
|
needs = ["release.build"]
|
||||||
args = "yarn run test"
|
args = "yarn run test"
|
||||||
}
|
}
|
||||||
|
|
||||||
action "release:publish" {
|
action "release.auth" {
|
||||||
needs = ["release:test"]
|
needs = ["release.test"]
|
||||||
|
uses = "actions/bin/filter@master"
|
||||||
|
args = ["actor", "octocat", "torvalds"]
|
||||||
|
}
|
||||||
|
|
||||||
|
action "release.npm.publish" {
|
||||||
|
needs = ["release.auth"]
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
args = "sh scripts/publish.sh"
|
args = "sh scripts/publish.sh"
|
||||||
secrets = [
|
secrets = [
|
||||||
@@ -84,8 +220,8 @@ action "release:publish" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
action "github-release" {
|
action "release.github" {
|
||||||
needs = ["release:publish"]
|
needs = ["release.npm.publish"]
|
||||||
uses = "docker://node:10"
|
uses = "docker://node:10"
|
||||||
args = "sh scripts/github-release.sh"
|
args = "sh scripts/github-release.sh"
|
||||||
secrets = [
|
secrets = [
|
||||||
|
|||||||
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
<a name="0.1.3"></a>
|
||||||
|
## [0.1.3](https://github.com/verdaccio/ui/compare/v0.1.2...v0.1.3) (2019-05-04)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="0.1.2"></a>
|
<a name="0.1.2"></a>
|
||||||
## [0.1.2](https://github.com/verdaccio/ui/compare/v0.1.1...v0.1.2) (2019-04-28)
|
## [0.1.2](https://github.com/verdaccio/ui/compare/v0.1.1...v0.1.2) (2019-04-28)
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module.exports = {
|
|||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
testEnvironment: 'jest-environment-jsdom-global',
|
testEnvironment: 'jest-environment-jsdom-global',
|
||||||
testURL: 'http://localhost',
|
testURL: 'http://localhost',
|
||||||
testRegex: '(test/unit/webui/.*\\.spec)\\.js',
|
testRegex: '(test/unit/.*\\.spec)\\.js',
|
||||||
setupFiles: [
|
setupFiles: [
|
||||||
'./test/unit/setup.js'
|
'./test/unit/setup.js'
|
||||||
],
|
],
|
||||||
@@ -35,6 +35,7 @@ module.exports = {
|
|||||||
'<rootDir>/build',
|
'<rootDir>/build',
|
||||||
],
|
],
|
||||||
snapshotSerializers: [
|
snapshotSerializers: [
|
||||||
|
'enzyme-to-json/serializer',
|
||||||
"jest-emotion"
|
"jest-emotion"
|
||||||
],
|
],
|
||||||
coveragePathIgnorePatterns: [
|
coveragePathIgnorePatterns: [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@verdaccio/ui-theme",
|
"name": "@verdaccio/ui-theme",
|
||||||
"version": "0.1.2",
|
"version": "0.1.3",
|
||||||
"description": "Verdaccio User Interface",
|
"description": "Verdaccio User Interface",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Verdaccio Core Team"
|
"name": "Verdaccio Core Team"
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
"emotion": "9.2.12",
|
"emotion": "9.2.12",
|
||||||
"enzyme": "3.9.0",
|
"enzyme": "3.9.0",
|
||||||
"enzyme-adapter-react-16": "1.10.0",
|
"enzyme-adapter-react-16": "1.10.0",
|
||||||
|
"enzyme-to-json": "3.3.5",
|
||||||
"eslint": "5.14.1",
|
"eslint": "5.14.1",
|
||||||
"eslint-config-google": "0.12.0",
|
"eslint-config-google": "0.12.0",
|
||||||
"eslint-config-prettier": "4.1.0",
|
"eslint-config-prettier": "4.1.0",
|
||||||
|
|||||||
@@ -3,7 +3,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { createBrowserHistory } from 'history';
|
import { createBrowserHistory } from 'history';
|
||||||
|
import { getBaseNamePath } from './utils/url';
|
||||||
|
|
||||||
const history = createBrowserHistory();
|
const history = createBrowserHistory({
|
||||||
|
basename: getBaseNamePath(),
|
||||||
|
});
|
||||||
|
|
||||||
export default history;
|
export default history;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
<link rel="icon" type="image/png" href="<%= htmlWebpackPlugin.options.verdaccioURL %>/-/static/favicon.ico" />
|
<link rel="icon" type="image/png" href="<%= htmlWebpackPlugin.options.verdaccioURL %>/-/static/favicon.ico" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<script>
|
<script>
|
||||||
|
window.__VERDACCIO_BASENAME_UI_OPTIONS = JSON.parse('<%= htmlWebpackPlugin.options.__UI_OPTIONS %>');
|
||||||
|
window.VERDACCIO_BASENAME = '<%= htmlWebpackPlugin.options.basename %>';
|
||||||
window.VERDACCIO_API_URL = '<%= htmlWebpackPlugin.options.verdaccioURL %>/-/verdaccio/';
|
window.VERDACCIO_API_URL = '<%= htmlWebpackPlugin.options.verdaccioURL %>/-/verdaccio/';
|
||||||
window.VERDACCIO_SCOPE = '<%= htmlWebpackPlugin.options.scope %>';
|
window.VERDACCIO_SCOPE = '<%= htmlWebpackPlugin.options.scope %>';
|
||||||
window.VERDACCIO_LOGO = '<%= htmlWebpackPlugin.options.logo %>';
|
window.VERDACCIO_LOGO = '<%= htmlWebpackPlugin.options.logo %>';
|
||||||
|
|||||||
@@ -2,3 +2,11 @@ export function getRegistryURL() {
|
|||||||
// Don't add slash if it's not a sub directory
|
// Don't add slash if it's not a sub directory
|
||||||
return `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
|
return `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getBaseNamePath() {
|
||||||
|
return window.__VERDACCIO_BASENAME_UI_OPTIONS.url_prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRootPath() {
|
||||||
|
return window.__VERDACCIO_BASENAME_UI_OPTIONS.base;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
import path from 'path';
|
|
||||||
|
|
||||||
export const parseConfigurationFile = (name) => {
|
|
||||||
return path.join(__dirname, `./partials/config/yaml/${name}.yaml`);
|
|
||||||
};
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import storage from '../../../src/webui/utils/storage';
|
import storage from '../../src/webui/utils/storage';
|
||||||
import App from '../../../src/webui/app';
|
import App from '../../src/webui/app';
|
||||||
|
|
||||||
import { generateTokenWithTimeRange } from './components/__mocks__/token';
|
import { generateTokenWithTimeRange } from './components/__mocks__/token';
|
||||||
|
|
||||||
jest.mock('../../../src/webui/utils/storage', () => {
|
jest.mock('../../src/webui/utils/storage', () => {
|
||||||
class LocalStorageMock {
|
class LocalStorageMock {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.store = {};
|
this.store = {};
|
||||||
@@ -26,7 +26,7 @@ jest.mock('../../../src/webui/utils/storage', () => {
|
|||||||
return new LocalStorageMock();
|
return new LocalStorageMock();
|
||||||
});
|
});
|
||||||
|
|
||||||
jest.mock('../../../src/webui/utils/api', () => ({
|
jest.mock('../../src/webui/utils/api', () => ({
|
||||||
request: require('./components/__mocks__/api').default.request
|
request: require('./components/__mocks__/api').default.request
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ describe('App', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = mount(<App />);
|
wrapper = mount(<App />);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('toggleLoginModal: should toggle the value in state', () => {
|
test('toggleLoginModal: should toggle the value in state', () => {
|
||||||
const { handleToggleLoginModal } = wrapper.instance();
|
const { handleToggleLoginModal } = wrapper.instance();
|
||||||
expect(wrapper.state().showLoginModal).toBeFalsy();
|
expect(wrapper.state().showLoginModal).toBeFalsy();
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`<NotFound /> component should load the component in default state 1`] = `ShallowWrapper {}`;
|
exports[`<NotFound /> component should load the component in default state 1`] = `<withRouter(WithTheme(WithWidth(NotFound))) />`;
|
||||||
@@ -6,8 +6,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
|
|
||||||
import CopyToClipBoard from '../../../../src/webui/components/CopyToClipBoard';
|
import CopyToClipBoard from '../../../src/webui/components/CopyToClipBoard/index';
|
||||||
import { CopyIcon } from '../../../../src/webui/components/CopyToClipBoard/styles';
|
import { CopyIcon } from '../../../src/webui/components/CopyToClipBoard/styles';
|
||||||
|
|
||||||
describe('<CopyToClipBoard /> component', () => {
|
describe('<CopyToClipBoard /> component', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import Footer from '../../../../src/webui/components/Footer/index';
|
import Footer from '../../../src/webui/components/Footer/index';
|
||||||
|
|
||||||
jest.mock('../../../../package.json', () => ({
|
jest.mock('../../../package.json', () => ({
|
||||||
version: '4.0.0-alpha.3'
|
version: '4.0.0-alpha.3'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
import { BrowserRouter as Router } from 'react-router-dom';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import Header from '../../../../src/webui/components/Header';
|
import Header from '../../../src/webui/components/Header/index';
|
||||||
|
|
||||||
describe('<Header /> component with logged in state', () => {
|
describe('<Header /> component with logged in state', () => {
|
||||||
let wrapper;
|
let wrapper;
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import Help from '../../../../src/webui/components/Help/index';
|
import Help from '../../../src/webui/components/Help/index';
|
||||||
|
|
||||||
describe('<Help /> component', () => {
|
describe('<Help /> component', () => {
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import LoginModal from '../../../../src/webui/components/Login';
|
import LoginModal from '../../../src/webui/components/Login/index';
|
||||||
|
|
||||||
const eventUsername = {
|
const eventUsername = {
|
||||||
target: {
|
target: {
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow, mount } from 'enzyme';
|
import { shallow, mount } from 'enzyme';
|
||||||
import NoItems from '../../../../src/webui/components/NoItems/index';
|
import NoItems from '../../../src/webui/components/NoItems/index';
|
||||||
|
|
||||||
console.error = jest.fn();
|
console.error = jest.fn();
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { BrowserRouter as Router } from 'react-router-dom';
|
import { BrowserRouter as Router } from 'react-router-dom';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import NotFound from '../../../../src/webui/components/NotFound/index';
|
import NotFound from '../../../src/webui/components/NotFound/index';
|
||||||
|
|
||||||
console.error = jest.fn();
|
console.error = jest.fn();
|
||||||
|
|
||||||
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow } from 'enzyme';
|
import { shallow } from 'enzyme';
|
||||||
import Package from '../../../../src/webui/components/Package/index';
|
import Package from '../../../src/webui/components/Package/index';
|
||||||
import Tag from '../../../../src/webui/components/Tag/index';
|
import Tag from '../../../src/webui/components/Tag/index';
|
||||||
import { Version, WrapperLink, Field, OverviewItem } from '../../../../src/webui/components/Package/styles';
|
import { Version, WrapperLink, Field, OverviewItem } from '../../../src/webui/components/Package/styles';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
import PackageList from '../../../../src/webui/components/PackageList/index';
|
import PackageList from '../../../src/webui/components/PackageList/index';
|
||||||
import Help from '../../../../src/webui/components/Help/index';
|
import Help from '../../../src/webui/components/Help/index';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
|
|
||||||
describe('<PackageList /> component', () => {
|
describe('<PackageList /> component', () => {
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { shallow, mount } from 'enzyme';
|
import { shallow, mount } from 'enzyme';
|
||||||
import Readme from '../../../../src/webui/components/Readme/index';
|
import Readme from '../../../src/webui/components/Readme/index';
|
||||||
|
|
||||||
describe('<Readme /> component', () => {
|
describe('<Readme /> component', () => {
|
||||||
test('should load the component in default state', () => {
|
test('should load the component in default state', () => {
|
||||||
@@ -6,11 +6,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mount } from 'enzyme';
|
import { mount } from 'enzyme';
|
||||||
|
|
||||||
import { Search } from '../../../../src/webui/components/Search/index';
|
import { Search } from '../../../src/webui/components/Search/index';
|
||||||
|
|
||||||
const SEARCH_FILE_PATH = '../../../../src/webui/components/Search/index';
|
const SEARCH_FILE_PATH = '../../../src/webui/components/Search/index';
|
||||||
const API_FILE_PATH = '../../../../src/webui/utils/api';
|
const API_FILE_PATH = '../../../src/webui/utils/api';
|
||||||
const URL_FILE_PATH = '../../../../src/webui/utils/url';
|
const URL_FILE_PATH = '../../../src/webui/utils/url';
|
||||||
|
|
||||||
// Global mocks
|
// Global mocks
|
||||||
const event = {
|
const event = {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import {API_ERROR} from '../../../../../src/lib/constants';
|
import {API_ERROR} from '../../../../src/lib/constants';
|
||||||
/**
|
/**
|
||||||
* API mock for login endpoint
|
* API mock for login endpoint
|
||||||
* @param {object} config configuration of api call
|
* @param {object} config configuration of api call
|
||||||
@@ -10,6 +10,7 @@ import Adapter from 'enzyme-adapter-react-16';
|
|||||||
configure({ adapter: new Adapter() });
|
configure({ adapter: new Adapter() });
|
||||||
|
|
||||||
global.__APP_VERSION__ = '1.0.0';
|
global.__APP_VERSION__ = '1.0.0';
|
||||||
|
global.__VERDACCIO_BASENAME_UI_OPTIONS = {};
|
||||||
|
|
||||||
// mocking few DOM methods
|
// mocking few DOM methods
|
||||||
if (global.document) {
|
if (global.document) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { isTokenExpire, makeLogin } from '../../../../src/webui/utils/login';
|
import { isTokenExpire, makeLogin } from '../../../src/webui/utils/login';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
generateTokenWithTimeRange,
|
generateTokenWithTimeRange,
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
formatDateDistance,
|
formatDateDistance,
|
||||||
getLastUpdatedPackageTime,
|
getLastUpdatedPackageTime,
|
||||||
getRecentReleases
|
getRecentReleases
|
||||||
} from '../../../../src/webui/utils/package';
|
} from '../../../src/webui/utils/package';
|
||||||
|
|
||||||
import { packageMeta } from '../components/store/packageMeta';
|
import { packageMeta } from '../components/store/packageMeta';
|
||||||
|
|
||||||
@@ -52,13 +52,21 @@ describe('formatDate', () => {
|
|||||||
|
|
||||||
describe('formatDateDistance', () => {
|
describe('formatDateDistance', () => {
|
||||||
test('should calculate the distance', () => {
|
test('should calculate the distance', () => {
|
||||||
|
const dateAboutTwoMonthsAgo = () => {
|
||||||
|
const date = new Date();
|
||||||
|
date.setMonth(date.getMonth() - 1);
|
||||||
|
date.setDate(date.getDay() - 20);
|
||||||
|
return date;
|
||||||
|
};
|
||||||
const dateTwoMonthsAgo = () => {
|
const dateTwoMonthsAgo = () => {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
date.setMonth(date.getMonth() - 2);
|
date.setMonth(date.getMonth() - 2);
|
||||||
return date;
|
return date;
|
||||||
};
|
};
|
||||||
const date = dateTwoMonthsAgo();
|
const date1 = dateAboutTwoMonthsAgo();
|
||||||
expect(formatDateDistance(date)).toEqual('about 2 months');
|
const date2 = dateTwoMonthsAgo();
|
||||||
|
expect(formatDateDistance(date1)).toEqual('about 2 months');
|
||||||
|
expect(formatDateDistance(date2)).toEqual('2 months');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -7,6 +7,7 @@ module.exports = {
|
|||||||
output: {
|
output: {
|
||||||
path: `${env.APP_ROOT}/static/`,
|
path: `${env.APP_ROOT}/static/`,
|
||||||
filename: '[name].[hash].js',
|
filename: '[name].[hash].js',
|
||||||
|
// FIXME: do we need this?
|
||||||
publicPath: 'ToReplaceByVerdaccio/-/static',
|
publicPath: 'ToReplaceByVerdaccio/-/static',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,9 @@ const prodConf = {
|
|||||||
}),
|
}),
|
||||||
new HTMLWebpackPlugin({
|
new HTMLWebpackPlugin({
|
||||||
title: 'ToReplaceByTitle',
|
title: 'ToReplaceByTitle',
|
||||||
|
__UI_OPTIONS: 'ToReplaceByVerdaccioUI',
|
||||||
scope: 'ToReplaceByScope',
|
scope: 'ToReplaceByScope',
|
||||||
|
basename: 'ToReplaceByPrefix',
|
||||||
logo: 'ToReplaceByLogo',
|
logo: 'ToReplaceByLogo',
|
||||||
primary_color: 'ToReplaceByPrimaryColor',
|
primary_color: 'ToReplaceByPrimaryColor',
|
||||||
filename: 'index.html',
|
filename: 'index.html',
|
||||||
|
|||||||
@@ -4771,6 +4771,13 @@ enzyme-adapter-utils@^1.10.0:
|
|||||||
prop-types "^15.7.2"
|
prop-types "^15.7.2"
|
||||||
semver "^5.6.0"
|
semver "^5.6.0"
|
||||||
|
|
||||||
|
enzyme-to-json@3.3.5:
|
||||||
|
version "3.3.5"
|
||||||
|
resolved "https://registry.verdaccio.org/enzyme-to-json/-/enzyme-to-json-3.3.5.tgz#f8eb82bd3d5941c9d8bc6fd9140030777d17d0af"
|
||||||
|
integrity sha512-DmH1wJ68HyPqKSYXdQqB33ZotwfUhwQZW3IGXaNXgR69Iodaoj8TF/D9RjLdz4pEhGq2Tx2zwNUIjBuqoZeTgA==
|
||||||
|
dependencies:
|
||||||
|
lodash "^4.17.4"
|
||||||
|
|
||||||
enzyme@3.9.0:
|
enzyme@3.9.0:
|
||||||
version "3.9.0"
|
version "3.9.0"
|
||||||
resolved "https://registry.npmjs.org/enzyme/-/enzyme-3.9.0.tgz#2b491f06ca966eb56b6510068c7894a7e0be3909"
|
resolved "https://registry.npmjs.org/enzyme/-/enzyme-3.9.0.tgz#2b491f06ca966eb56b6510068c7894a7e0be3909"
|
||||||
|
|||||||
Reference in New Issue
Block a user