summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2018-06-05 17:11:03 +0200
committerAndrej Mihajlov <and@mullvad.net>2018-06-12 15:58:20 +0200
commitfe3e41f0b5c95e50736565f1faaa212460fb7051 (patch)
treef970c3118549c0110c7349fd00ad12cd4e818ce2 /test
parent70cf899e378875970050b4fd84ffe7e4973d8dc3 (diff)
downloadmullvadvpn-fe3e41f0b5c95e50736565f1faaa212460fb7051.tar.xz
mullvadvpn-fe3e41f0b5c95e50736565f1faaa212460fb7051.zip
Update tests
Diffstat (limited to 'test')
-rw-r--r--test/components/Account.spec.js39
1 files changed, 15 insertions, 24 deletions
diff --git a/test/components/Account.spec.js b/test/components/Account.spec.js
index c9d0891022..c4b50a740c 100644
--- a/test/components/Account.spec.js
+++ b/test/components/Account.spec.js
@@ -6,30 +6,26 @@ import { shallow } from 'enzyme';
require('../setup/enzyme');
import Account from '../../app/components/Account';
-import type { AccountReduxState } from '../../app/redux/account/reducers';
import type { AccountProps } from '../../app/components/Account';
describe('components/Account', () => {
- const state: AccountReduxState = {
- accountToken: '1234',
- accountHistory: [],
- expiry: new Date('2038-01-01').toISOString(),
- status: 'none',
- error: null,
- };
-
- const makeProps = (state: AccountReduxState, mergeProps: $Shape<AccountProps>): AccountProps => {
+ const makeProps = (mergeProps: $Shape<AccountProps>): AccountProps => {
const defaultProps: AccountProps = {
- account: state,
+ accountToken: '1234',
+ accountExpiry: new Date('2038-01-01').toISOString(),
+ updateAccountExpiry: () => Promise.resolve(),
onClose: () => {},
onLogout: () => {},
onBuyMore: () => {},
};
- return Object.assign({}, defaultProps, mergeProps);
+ return {
+ ...defaultProps,
+ ...mergeProps,
+ };
};
it('should call close callback', (done) => {
- const props = makeProps(state, {
+ const props = makeProps({
onClose: () => done(),
});
const component = getComponent(render(props), 'account__close');
@@ -37,7 +33,7 @@ describe('components/Account', () => {
});
it('should call logout callback', (done) => {
- const props = makeProps(state, {
+ const props = makeProps({
onLogout: () => done(),
});
const component = getComponent(render(props), 'account__logout');
@@ -45,7 +41,7 @@ describe('components/Account', () => {
});
it('should call "buy more" callback', (done) => {
- const props = makeProps(state, {
+ const props = makeProps({
onBuyMore: () => done(),
});
const component = getComponent(render(props), 'account__buymore');
@@ -53,20 +49,15 @@ describe('components/Account', () => {
});
it('should display "out of time" message when account expired', () => {
- const expiredState: AccountReduxState = {
- accountToken: '1234',
- accountHistory: [],
- expiry: new Date('2001-01-01').toISOString(),
- status: 'none',
- error: null,
- };
- const props = makeProps(expiredState, {});
+ const props = makeProps({
+ accountExpiry: new Date('2001-01-01').toISOString(),
+ });
const component = getComponent(render(props), 'account__out_of_time');
expect(component).to.have.length(1);
});
it('should not display "out of time" message when account is active', () => {
- const props = makeProps(state, {});
+ const props = makeProps({});
const component = getComponent(render(props), 'account__out_of_time');
expect(component).to.have.length(0);
});