diff --git a/src-react/__tests__/components/alert-area/new-version-available.test.js b/src-react/__tests__/components/alert-area/new-version-available.test.js
new file mode 100644
index 0000000..ecd494b
--- /dev/null
+++ b/src-react/__tests__/components/alert-area/new-version-available.test.js
@@ -0,0 +1,52 @@
+jest.dontMock('components/alert-area/new-version-available');
+import sinon from 'sinon';
+import React from 'react';
+import { shallow, mount, render } from 'enzyme';
+import NewVersionAvailable from 'components/alert-area/new-version-available';
+
+describe('alert-area/new-version-available component', () => {
+ let wrapper;
+ let platform = 'windows';
+ const latestVersion = '1.3';
+ const onDismiss = sinon.spy();
+
+ beforeEach(() => {
+ wrapper = mount(
+ { ' npm update -g ungit' }
)).toBe(true);
+ expect(wrapper.find('button').length).toBe(1);
+ });
+
+ it('should trigger click events when clicking dismiss button', () => {
+ wrapper.find('button').simulate('click');
+ expect(onDismiss.callCount).toBe(1);
+ });
+
+ describe('when platform is not existing', () => {
+ beforeEach(() => {
+ platform = null;
+ wrapper = mount(
+ { 'sudo -H npm update -g ungit' }
)).toBe(true);
+ });
+ });
+});
\ No newline at end of file
diff --git a/src-react/__tests__/reducers/app.js b/src-react/__tests__/reducers/app.js
index 6423dfb..acbf6b3 100644
--- a/src-react/__tests__/reducers/app.js
+++ b/src-react/__tests__/reducers/app.js
@@ -228,4 +228,23 @@ describe('app.js reducers', () => {
});
});
});
+
+ describe('when DISMISS_GIT_VERSION_ERROR action dispatch', () => {
+ it('should force set gitVersionErrorDismissed as ture in localStorage', () => {
+ const state = app(initialState, { type: types.DISMISS_GIT_VERSION_ERROR }, {});
+ expect(localStorage.getItem('gitVersionErrorDismissed')).toEqual('true');
+ });
+
+ it('gitVersionErrorVisible state will be false', () => {
+ const state = app(initialState, { type: types.DISMISS_GIT_VERSION_ERROR }, {});
+ expect(state.gitVersionErrorVisible).toBe(false);
+ });
+ });
+
+ describe('when DISMISS_NEW_VERSION action dispatch', () => {
+ it('showNewVersionAvailable state will be false', () => {
+ const state = app(initialState, { type: types.DISMISS_NEW_VERSION }, {});
+ expect(state.showNewVersionAvailable).toBe(false);
+ });
+ });
});
\ No newline at end of file
diff --git a/src-react/actions/version.js b/src-react/actions/version.js
index 210090f..fa00dd2 100644
--- a/src-react/actions/version.js
+++ b/src-react/actions/version.js
@@ -31,4 +31,8 @@ export function fetchGitVersion() {
export function dismissGitVersionError() {
return { type: types.DISMISS_GIT_VERSION_ERROR };
+}
+
+export function dismissNewVersion() {
+ return { type: types.DISMISS_NEW_VERSION };
}
\ No newline at end of file
diff --git a/src-react/components/alert-area/index.js b/src-react/components/alert-area/index.js
index 6737cc7..d9ae726 100644
--- a/src-react/components/alert-area/index.js
+++ b/src-react/components/alert-area/index.js
@@ -43,7 +43,8 @@ class AlertArea extends Component {
showNewVersionAvailable ? (
{ newVersionInstallCommand }
to install.
- See what's new in the
+ { `${platform ? '' : 'sudo -H'} npm update -g ungit` }
to install.
+ See what's new in the
changelog.
-
+