Skip to content

Commit

Permalink
Remove the obsolete timerReset action
Browse files Browse the repository at this point in the history
  • Loading branch information
reyraa committed Nov 21, 2022
1 parent 84ac38d commit 17a7952
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 37 deletions.
9 changes: 0 additions & 9 deletions src/modules/auth/store/action.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
/* eslint-disable max-lines */
import actionTypes from './actionTypes';

/**
* Fires an action to reset the account automatic sign out timer
* @param {Date} date - Current date
*/
export const timerReset = () => ({
type: actionTypes.timerReset,
data: new Date(),
});

/** export const accountLoading = () => ({
type: actionTypes.accountLoading,
}); */
Expand Down
1 change: 0 additions & 1 deletion src/modules/auth/store/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const actionTypes = {
accountUpdated: 'ACCOUNT_UPDATED',
secondPassphraseStored: 'SECOND_PASSPHRASE_STORED',
secondPassphraseRemoved: 'SECOND_PASSPHRASE_REMOVED',
timerReset: 'TIMER_RESET',
};

export default actionTypes;
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@
import React, { useState } from 'react';
import Countdown from 'react-countdown';
import { toast } from 'react-toastify';
import { useDispatch } from 'react-redux';
import { withTranslation } from 'react-i18next';
import { timerReset } from '@auth/store/action';
import { timeOutWarningId } from 'src/utils/toasts';
import account from '@wallet/configuration/constants';
import styles from './autoSignOut.css';

const TimeOutToast = ({
t, upDateCount, completed, expireTime,
}) => {
const dispatch = useDispatch();

const onResetTime = () => {
if (new Date().getTime() < new Date(expireTime).getTime()) {
upDateCount();
dispatch(timerReset());
}
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import React from 'react';
import { mount } from 'enzyme';
import { timerReset } from '@auth/store/action';
import account from '@wallet/configuration/constants';
import Warning from './warning';

jest.mock('react-toastify', () => ({
toast: (component) => (component),
}));

jest.mock('@auth/store/action', () => ({
timerReset: jest.fn(),
}));

describe('Warning', () => {
const date = Date.now();
const expireTime = date + account.lockDuration;
Expand All @@ -37,6 +32,5 @@ describe('Warning', () => {
wrapper.update();
expect(wrapper).not.toBeEmptyRender();
wrapper.find('.reset-time-button').simulate('click');
expect(timerReset).toHaveBeenCalled();
});
});
2 changes: 0 additions & 2 deletions src/modules/dpos/validator/store/actions/voting.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import to from 'await-to-js';
// import { tokenMap } from '@token/fungible/consts/tokens';
import { selectActiveTokenAccount } from 'src/redux/selectors';
import { signTransaction } from '@transaction/api';
import { timerReset } from '@auth/store/action';
import txActionTypes from '@transaction/store/actionTypes';
import { joinModuleAndCommand } from '@transaction/utils';
import { getVotes } from '../../api';
Expand Down Expand Up @@ -92,7 +91,6 @@ export const votesSubmitted =
});
} else {
dispatch({ type: actionTypes.votesSubmitted });
dispatch(timerReset());
dispatch({
type: txActionTypes.transactionCreatedSuccess,
data: tx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ describe('Setting', () => {
const props = {
transactions: { pending: [] },
account: { token: 'LSK', passphrase: 'sample_passphrase' },
timerReset: jest.fn(),
settingsUpdated: jest.fn(),
settings,
t,
Expand Down Expand Up @@ -65,7 +64,6 @@ describe('Setting', () => {

// it('should change autolog setting when clicking on checkbox', () => {
// wrapper.find('.autoLog input').at(0).simulate('change', { target: { name: 'autoLog' } });
// expect(props.timerReset).toBeCalled();
// });

// it('should change discreet mode setting when clicking on checkbox', () => {
Expand Down Expand Up @@ -112,7 +110,6 @@ describe('Setting', () => {

// wrapper.find('.autoLog input').at(0).simulate('change', { target: { name: 'autoLog' } });

// expect(props.timerReset).toBeCalled();
// });
// });
});
2 changes: 0 additions & 2 deletions src/modules/settings/manager/SettingsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { connect } from 'react-redux';
import { withTranslation } from 'react-i18next';
import { selectActiveTokenAccount } from 'src/redux/selectors';
import { settingsUpdated } from 'src/redux/actions';
import { timerReset } from '@auth/store/action';
import SettingDialog from '../components/SettingDialog';

const mapStateToProps = state => ({
Expand All @@ -13,7 +12,6 @@ const mapStateToProps = state => ({
});

const mapDispatchToProps = {
timerReset,
settingsUpdated,
};

Expand Down
8 changes: 0 additions & 8 deletions src/modules/transaction/store/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,12 @@ describe.skip('actions: transactions', () => {
type: actionTypes.broadcastedTransactionSuccess,
data: sampleTransaction,
};
const lastExpectedAction = {
type: walletActionTypes.timerReset,
data: new Date(),
};

// Act
await transactionBroadcasted(sampleTransaction)(dispatch, getState);

// Assert
expect(dispatch).toHaveBeenCalledWith(expectedAction);
expect(dispatch).toHaveBeenLastCalledWith(lastExpectedAction);
});

it('should dispatch broadcastedTransactionError action when broadcast has an error', async () => {
Expand Down Expand Up @@ -301,16 +296,13 @@ describe.skip('actions: transactions', () => {
// type: actionTypes.pendingTransactionAdded,
// data: { ...transformedAccountTransaction, isPending: true },
// };
const expectedAction3 = { data: expect.anything(), type: walletActionTypes.timerReset };

// Act
await transactionBroadcasted(sampleTransaction)(dispatch, getState);

// Assert
expect(httpApi).toHaveBeenCalled();
expect(dispatch).toHaveBeenNthCalledWith(1, expectedAction1);
// expect(dispatch).toHaveBeenNthCalledWith(2, expectedAction2);
expect(dispatch).toHaveBeenNthCalledWith(3, expectedAction3);
});
});

Expand Down
1 change: 0 additions & 1 deletion src/modules/wallet/store/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const actionTypes = {
accountUpdated: 'ACCOUNT_UPDATED',
secondPassphraseStored: 'SECOND_PASSPHRASE_STORED',
secondPassphraseRemoved: 'SECOND_PASSPHRASE_REMOVED',
timerReset: 'TIMER_RESET',
};

export default actionTypes;

0 comments on commit 17a7952

Please sign in to comment.