This repository has been archived by the owner on Jun 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Add basic tests for frontend #48
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e453df5
Add basic tests for UI
garatortiz ff3a70b
Add className to UI components
garatortiz 10347ef
Fix linter
garatortiz c79e104
Remove unnecessary square brackets
fvictorio 3423339
Merge branch 'master' into issue-#10
garatortiz 71f9234
Fix frontend test
garatortiz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import BankAccountList from '../ui/BankAccountList' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<BankAccountList />', () => { | ||
it('renders correctly for 0 bank accounts', () => { | ||
const wrapper = mount(<BankAccountList bankAccounts={[]} />) | ||
|
||
expect(wrapper.find('div.bank-account-list')).toHaveLength(1) | ||
expect(wrapper.find('div.bank-account-list div.bank-account-item')).toHaveLength(0) | ||
}) | ||
|
||
it('renders correctly for 1+ bank accounts', () => { | ||
const wrapper = mount(<BankAccountList bankAccounts={['bank_account_1', 'bank_account_2']} />) | ||
|
||
expect(wrapper.find('div.bank-account-list')).toHaveLength(1) | ||
expect(wrapper.find('div.bank-account-list div.bank-account-item')).toHaveLength(2) | ||
expect(wrapper.find('div.bank-account-list button')).toHaveLength(2) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import Footer from '../ui/Footer' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<Footer />', () => { | ||
it('renders correctly', () => { | ||
const wrapper = mount(<Footer />) | ||
|
||
expect(wrapper.find('div.footer')).toHaveLength(1) | ||
expect(wrapper.find('div div.logo-container')).toHaveLength(1) | ||
expect(wrapper.find('div div.logo-container p')).toHaveLength(1) | ||
expect(wrapper.find('div div.logo-container a.poa-logo')).toHaveLength(1) | ||
expect(wrapper.find('div div.logo-container div.social-container')).toHaveLength(1) | ||
expect(wrapper.find('div div.logo-container div.social-container a.social-item')).toHaveLength( | ||
3 | ||
) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import Header from '../ui/Header' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<Header />', () => { | ||
it('renders correctly', () => { | ||
const wrapper = mount(<Header />) | ||
|
||
expect(wrapper.find('header')).toHaveLength(1) | ||
expect(wrapper.find('header div.logo-container')).toHaveLength(1) | ||
expect(wrapper.find('header div.logo-container a.poa-logo')).toHaveLength(1) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import Loading from '../ui/Loading' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<Loading />', () => { | ||
it('renders correctly when show is false', () => { | ||
const wrapper = mount(<Loading />) | ||
|
||
expect(wrapper.find('div.loading-container')).toHaveLength(0) | ||
}) | ||
it('renders correctly when show is true', () => { | ||
const wrapper = mount(<Loading show={true} />) | ||
|
||
expect(wrapper.find('div.loading-container')).toHaveLength(1) | ||
expect(wrapper.find('div.loading-container div.loading-inner')).toHaveLength(1) | ||
expect(wrapper.find('div.loading-container div.loading-inner div.loading-dot')).toHaveLength(6) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import Logo from '../ui/Logo' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<Logo />', () => { | ||
it('renders correctly', () => { | ||
const wrapper = mount(<Logo />) | ||
|
||
expect(wrapper.find('a.poa-logo')).toHaveLength(1) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import LogoContainer from '../ui/LogoContainer' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<LogoContainer />', () => { | ||
it('renders correctly', () => { | ||
const wrapper = mount(<LogoContainer />) | ||
|
||
expect(wrapper.find('div.logo-container')).toHaveLength(1) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import Main from '../ui/Main' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<Main />', () => { | ||
it('renders correctly', () => { | ||
const wrapper = mount(<Main />) | ||
|
||
expect(wrapper.find('div')).toHaveLength(1) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import RegisteredAccountsList from '../ui/RegisteredAccountsList' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<RegisteredAccountsList />', () => { | ||
it('renders correctly for 0 accounts', () => { | ||
const wrapper = mount(<RegisteredAccountsList accounts={[]} />) | ||
|
||
expect(wrapper.find('div.registered-accounts-list')).toHaveLength(0) | ||
}) | ||
|
||
it('renders correctly for 1+ accounts', () => { | ||
const wrapper = mount(<RegisteredAccountsList accounts={['account_1', 'account_2']} />) | ||
|
||
expect(wrapper.find('div.registered-accounts-list')).toHaveLength(1) | ||
expect(wrapper.find('div.registered-accounts-list ul')).toHaveLength(1) | ||
expect(wrapper.find('div.registered-accounts-list ul li')).toHaveLength(2) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react' | ||
import { configure, mount } from 'enzyme' | ||
import Adapter from 'enzyme-adapter-react-16' | ||
import Title from '../ui/Title' | ||
|
||
configure({ adapter: new Adapter() }) | ||
|
||
describe('<Title />', () => { | ||
it('renders correctly', () => { | ||
const wrapper = mount(<Title />) | ||
|
||
expect(wrapper.find('h1')).toHaveLength(1) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the array necessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not... I used it only for the first
expect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not asking why did you add the class. I'm saying that this is the only place where an array is used instead of just listing the arguments. We should use the API consistently even if glamorous accepts different ways of specifying the parameters.
But maybe there was a reason to use it this way here, that was the question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now I understand the question. Based on what I read about Glomorous, I understood that the way to indicate two or more classes is with an array, and when it is only one class it can be listed or use an array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find anything about that in the documentation. Can you give me a link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember where I had read it, or if I just tried and it worked... but I only did it for that test... in any case we can remove it if you think so.