Skip to content
This repository was archived by the owner on Jul 2, 2023. It is now read-only.

Commit a648f5a

Browse files
Merge pull request #14 from AndresMorelos/fix-test-suite
Fixing test suite and some lints.
2 parents 5b95cf3 + 42fe56d commit a648f5a

File tree

170 files changed

+1490
-1051
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

170 files changed

+1490
-1051
lines changed

.eslintrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ rules:
2828
radix: off
2929
func-names: off
3030
jsx-a11y/label-has-associated-control: off
31+
no-param-reassign: off
3132

3233
# RULES THAT WE SHOULD INVESTIGATE AND PROBABLY ENABLE]
3334
react/jsx-props-no-spreading: off
@@ -69,3 +70,5 @@ rules:
6970
react/jsx-filename-extension: off
7071
jsx-a11y/label-has-for: off
7172
jsx-a11y/anchor-is-valid: off
73+
settings:
74+
import/resolver: webpack

__mocks__/@electron/remote.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
require: jest.fn((name) => {
3+
if (name === 'electron-settings') {
4+
return {
5+
setSync: jest.fn(),
6+
getSync: jest.fn(() => 'someSettings'),
7+
};
8+
}
9+
})
10+
};

__mocks__/electron.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1+
const { encryptData, decryptData } = require('../test/helper');
2+
13
module.exports = {
24
app: jest.fn(),
35
ipcRenderer: {
46
send: jest.fn(),
57
on: jest.fn(),
8+
sendSync: jest.fn((name, { message, content }) => {
9+
if (name === 'encrypt-data') {
10+
const dataEncrypted = encryptData({ message });
11+
return dataEncrypted;
12+
}
13+
14+
if (name === 'decrypt-data') {
15+
const dataDecrypted = decryptData({ content });
16+
return dataDecrypted;
17+
}
18+
}),
619
},
720
remote: {
8-
require: jest.fn(name => {
21+
require: jest.fn((name) => {
922
if (name === 'electron-settings') {
1023
return {
11-
set: jest.fn(),
12-
get: jest.fn(() => 'someSettings'),
24+
setSync: jest.fn(),
25+
getSync: jest.fn(() => 'someSettings'),
1326
};
1427
}
1528
}),

__mocks__/fileMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {}

__mocks__/styleMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {}

__mocks__/uuid.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
v4: () => 'id-string'
3+
}

__mocks__/uuid/v4.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

app/App.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22
import React, { PureComponent } from 'react';
33
import PropTypes from 'prop-types';
44
import { connect } from 'react-redux';
5-
const ipc = require('electron').ipcRenderer;
65

76
// Actions
7+
import AppNav from '@components/layout/AppNav';
8+
import AppMain from '@components/layout/AppMain';
9+
import AppNoti from '@components/layout/AppNoti';
10+
import AppUpdate from '@components/layout/AppUpdate';
11+
import { AppWrapper, LoginWrapper } from '@components/shared/Layout';
812
import * as UIActions from './actions/ui';
913
import * as FormActions from './actions/form';
1014
import * as SettingsActions from './actions/settings';
1115
import * as InvoicesActions from './actions/invoices';
1216
import * as ContactsActions from './actions/contacts';
1317

1418
// Components
15-
import AppNav from '@components/layout/AppNav';
16-
import AppMain from '@components/layout/AppMain';
17-
import AppNoti from '@components/layout/AppNoti';
18-
import AppUpdate from '@components/layout/AppUpdate';
19-
import { AppWrapper, LoginWrapper } from '@components/shared/Layout';
2019

21-
//Reducers
20+
// Reducers
2221
import { getSecretKey } from './reducers/LoginReducer'
2322
import Login from './containers/Login';
2423

2524
import windowStateKeeper from '../helpers/windowStateKeeper';
2625
import resize from './helpers/resize'
2726
import { Notify } from '../helpers/notify'
27+
const ipc = require('electron').ipcRenderer;
2828

2929
// Components
3030
class App extends PureComponent {
@@ -38,7 +38,7 @@ class App extends PureComponent {
3838
componentDidMount() {
3939
const { dispatch } = this.props;
4040
// Get All Data
41-
dispatch(SettingsActions.getInitalSettings());
41+
dispatch(SettingsActions.getInitialSettings());
4242
// Add Event Listener
4343
ipc.on('menu-change-tab', (event, tabName) => {
4444
this.changeTab(tabName);

app/actions/__tests__/settings.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as ACTION_TYPES from '../../constants/actions';
22
import * as actions from '../settings';
33

4-
it('getInitalSettings should create GET_INITIAL_SETTINGS action', () => {
5-
expect(actions.getInitalSettings()).toEqual({
4+
it('getInitialSettings should create GET_INITIAL_SETTINGS action', () => {
5+
expect(actions.getInitialSettings()).toEqual({
66
type: ACTION_TYPES.SETTINGS_GET_INITIAL,
77
});
88
});

app/actions/contacts.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as ACTION_TYPES from '../constants/actions.jsx';
21
import { createAction } from 'redux-actions';
2+
import * as ACTION_TYPES from '../constants/actions.jsx';
33

44
// Get All Contacts
55
export const getAllContacts = createAction(ACTION_TYPES.CONTACT_GET_ALL);

app/actions/form.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as ACTION_TYPES from '../constants/actions.jsx';
21
import { createAction } from 'redux-actions';
2+
import * as ACTION_TYPES from '../constants/actions.jsx';
33

44
// Recipient
55
export const updateRecipient = createAction(

app/actions/invoices.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as ACTION_TYPES from '../constants/actions.jsx';
21
import { createAction } from 'redux-actions';
2+
import * as ACTION_TYPES from '../constants/actions.jsx';
33

44
export const getInvoices = createAction(ACTION_TYPES.INVOICE_GET_ALL);
55

app/actions/login.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as ACTION_TYPES from '../constants/actions.jsx'
21
import { createAction } from 'redux-actions';
2+
import * as ACTION_TYPES from '../constants/actions.jsx'
33

44
export const getSecretKey = createAction(ACTION_TYPES.LOGIN_GET_SECRET);
55

app/actions/settings.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import * as ACTION_TYPES from '../constants/actions.jsx';
21
import { createAction } from 'redux-actions';
2+
import * as ACTION_TYPES from '../constants/actions.jsx';
33

44
// Get Initial Settings
5-
export const getInitalSettings = createAction(
5+
export const getInitialSettings = createAction(
66
ACTION_TYPES.SETTINGS_GET_INITIAL
77
);
88

app/actions/ui.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as ACTION_TYPES from '../constants/actions.jsx';
21
import { createAction } from 'redux-actions';
2+
import * as ACTION_TYPES from '../constants/actions.jsx';
33

44
// Change Active Tab
55
export const changeActiveTab = createAction(

app/components/contacts/__tests__/Contact.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Libs
2+
import 'jsdom-global/register';
23
import React from 'react';
34
import { shallow, mount } from 'enzyme';
45
import renderer from 'react-test-renderer';

app/components/contacts/__tests__/__snapshots__/Contact.spec.js.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22

33
exports[`Renders correctly to the DOM matches snapshot 1`] = `
44
<tr
5-
className="Table__TRStyle-gHmqLx BngTM"
5+
className="Table__TRStyle-sc-vcm0yz-4 fRFFvW"
66
>
77
<td
8-
className="Table__TDStyle-cAmfHP hlnQVD"
8+
className="Table__TDStyle-sc-vcm0yz-5 diKbJX"
99
>
1010
Jon Snow
1111
</td>
1212
<td
13-
className="Table__TDStyle-cAmfHP jrRCak"
13+
className="Table__TDStyle-sc-vcm0yz-5 gCUxXq"
1414
>
1515
jon@snow.hbo
1616
</td>
1717
<td
18-
className="Table__TDStyle-cAmfHP jrRCak"
18+
className="Table__TDStyle-sc-vcm0yz-5 gCUxXq"
1919
>
2020
000-000-000
2121
</td>
2222
<td
23-
className="Table__TDStyle-cAmfHP evw"
23+
className="Table__TDStyle-sc-vcm0yz-5 VeXuP"
2424
>
2525
<button
26-
className="Button__ButtonLinkStyle-caVwCA lhMtRH"
26+
className="Button__ButtonLinkStyle-sc-lvp9e-1 bwiUrL"
2727
onClick={[Function]}
2828
>
2929
<i
3030
className="ion-plus-round"
3131
/>
3232
</button>
3333
<button
34-
className="Button__ButtonLinkStyle-caVwCA gvxXrI"
34+
className="Button__ButtonLinkStyle-sc-lvp9e-1 jxxsjo"
3535
onClick={[Function]}
3636
>
3737
<i

app/components/form/Currency.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Libs
22
import React, { PureComponent } from 'react';
33
import PropTypes from 'prop-types';
4-
const appConfig = require('@electron/remote').require('electron-settings');
5-
import currencies from '../../../libs/currencies.json';
64
import { keys, sortBy, isEqual } from 'lodash';
5+
import currencies from '../../../libs/currencies.json';
76

87
// Custom Components
98
import { Section, Header } from '../shared/Section';

app/components/form/Discount.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import PropTypes from 'prop-types';
44
import { isEmpty } from 'lodash';
55

66
// Custom Components
7+
import styled from 'styled-components';
78
import { Section } from '../shared/Section';
89

910
// Animation
1011
import _withFadeInAnimation from '../shared/hoc/_withFadeInAnimation';
1112

1213
// Styles
13-
import styled from 'styled-components';
1414
const DiscountWrapper = styled.div`
1515
display: flex;
1616
flex-direction: column;

app/components/form/DueDatePicker.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import 'react-dates/lib/css/_datepicker.css'
99
import { SingleDatePicker } from 'react-dates';
1010

1111
// Styles
12-
import _withFadeInAnimation from '../shared/hoc/_withFadeInAnimation';
1312
import styled from 'styled-components';
13+
import _withFadeInAnimation from '../shared/hoc/_withFadeInAnimation';
1414
const Container = styled.div`
1515
display: flex;
1616
margin-bottom: 20px;

app/components/form/DueDateTerms.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import React, { Component } from 'react';
33
import PropTypes from 'prop-types';
44

55
// Styles
6-
import _withFadeInAnimation from '../shared/hoc/_withFadeInAnimation';
76
import styled from 'styled-components';
7+
import _withFadeInAnimation from '../shared/hoc/_withFadeInAnimation';
88
const Container = styled.div`
99
display: flex;
1010
margin-bottom: 20px;

app/components/form/InvoiceID.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import React, { PureComponent } from 'react';
33
import PropTypes from 'prop-types';
44

55
// Custom Components
6+
import styled from 'styled-components';
67
import { Section } from '../shared/Section';
78

89
// Animation
910
import _withFadeInAnimation from '../shared/hoc/_withFadeInAnimation';
1011

1112
// Styles
12-
import styled from 'styled-components';
1313
const NoteContent = styled.textarea`
1414
min-height: 36px;
1515
border-radius: 4px;

app/components/form/ItemRow.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import PropTypes from 'prop-types';
44
import { compose } from 'recompose';
55

66
// HOCs
7+
import styled from 'styled-components';
78
import _withDraggable from './hoc/_withDraggable';
89

910
// Styles
10-
import styled from 'styled-components';
1111

1212
const ItemDiv = styled.div`
1313
position: relative;

app/components/form/ItemsList.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ import { withTranslation } from 'react-i18next';
77
import { compose } from 'recompose';
88
import { connect } from 'react-redux';
99
import { bindActionCreators } from 'redux';
10+
import TransitionList from '@components/shared/TransitionList';
11+
import styled from 'styled-components';
1012
import * as Actions from '../../actions/form.jsx';
1113
import { getRows } from '../../reducers/FormReducer';
1214

1315
// DragNDrop
14-
import TransitionList from '@components/shared/TransitionList';
1516
import _withDragNDrop from './hoc/_withDragNDrop';
1617

1718
// Custom Component
@@ -20,7 +21,6 @@ import { Section } from '../shared/Section';
2021
import ItemRow from './ItemRow.jsx';
2122

2223
// Styled Components
23-
import styled from 'styled-components';
2424

2525
const ItemsListWrapper = styled.div`
2626
position: relative;

app/components/form/Note.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import React, { Component } from 'react';
33
import PropTypes from 'prop-types';
44

55
// Custom Components
6+
import styled from 'styled-components';
67
import { Section } from '../shared/Section';
78

89
// Animation
910
import _withFadeInAnimation from '../shared/hoc/_withFadeInAnimation';
1011

1112
// Styles
12-
import styled from 'styled-components';
1313
const NoteContent = styled.textarea`
1414
min-height: 36px;
1515
border-radius: 4px;

app/components/form/Payment.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import PropTypes from 'prop-types';
33
import { isEqual } from 'lodash';
44

55
// Custom Components
6+
import styled from 'styled-components';
67
import { Section, Header } from '../shared/Section';
78

89
// Animation
910
import _withFadeInAnimation from '../shared/hoc/_withFadeInAnimation';
1011

1112
// Styles
12-
import styled from 'styled-components';
1313
const PaymentContent = styled.textarea`
1414
min-height: 36px;
1515
border-radius: 4px;

0 commit comments

Comments
 (0)