Skip to content

Commit

Permalink
test: added tests for notifications reducer (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
jglover authored and andrewda committed Oct 25, 2017
1 parent a43d3bc commit 3c78a80
Show file tree
Hide file tree
Showing 14 changed files with 539 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,8 @@
"avatar_url": "https://avatars1.githubusercontent.com/u/40802?v=4",
"profile": "http://jamesmglover.com",
"contributions": [
"code"
"code",
"test"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"repository": "repository",
"search": "search",
"testData": "./__tests__/data",
"user": "user",
"utils": "utils"
}
}
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ Thank you to all the people who have already contributed to GitPoint!
| [<img src="https://avatars0.githubusercontent.com/u/18398761?v=4" width="100px;"/><br /><sub>Vitaliy Kanev</sub>](https://github.com/vitalkanev)<br />[📖](https://github.com/gitpoint/git-point/commits?author=vitalkanev "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/3691490?v=4" width="100px;"/><br /><sub>Peter Dave Hello</sub>](https://www.peterdavehello.org/)<br />[📖](https://github.com/gitpoint/git-point/commits?author=PeterDaveHello "Documentation") [🔧](#tool-PeterDaveHello "Tools") | [<img src="https://avatars3.githubusercontent.com/u/10849025?v=4" width="100px;"/><br /><sub>Ernoff</sub>](https://github.com/Ernoff)<br />[💻](https://github.com/gitpoint/git-point/commits?author=Ernoff "Code") [🐛](https://github.com/gitpoint/git-point/issues?q=author%3AErnoff "Bug reports") | [<img src="https://avatars3.githubusercontent.com/u/820696?v=4" width="100px;"/><br /><sub>Matthew Brandly</sub>](http://words.brandly.me/about/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=brandly "Code") | [<img src="https://avatars2.githubusercontent.com/u/11836470?v=4" width="100px;"/><br /><sub>João Fonseca</sub>](https://github.com/Jpfonseca)<br />[🌍](#translation-Jpfonseca "Translation") | [<img src="https://avatars3.githubusercontent.com/u/10121964?v=4" width="100px;"/><br /><sub>Arjun Curat</sub>](https://github.com/acurat)<br />[📖](https://github.com/gitpoint/git-point/commits?author=acurat "Documentation") |
| [<img src="https://avatars3.githubusercontent.com/u/16878891?v=4" width="100px;"/><br /><sub>siderio2</sub>](https://github.com/siderio2)<br />[🌍](#translation-siderio2 "Translation") | [<img src="https://avatars1.githubusercontent.com/u/32579769?v=4" width="100px;"/><br /><sub>Kodo Verkisto</sub>](https://github.com/kodisto)<br />[🌍](#translation-kodisto "Translation") | [<img src="https://avatars3.githubusercontent.com/u/82317?v=4" width="100px;"/><br /><sub>Sarah Vessels</sub>](http://sarahvessels.com/)<br />[📖](https://github.com/gitpoint/git-point/commits?author=cheshire137 "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/3764756?v=4" width="100px;"/><br /><sub>Thales Sousa</sub>](https://github.com/tminussi)<br />[🌍](#translation-tminussi "Translation") | [<img src="https://avatars0.githubusercontent.com/u/6106941?v=4" width="100px;"/><br /><sub>Aseem Sood</sub>](https://github.com/asood123)<br />[📖](https://github.com/gitpoint/git-point/commits?author=asood123 "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/7842156?v=4" width="100px;"/><br /><sub>Eliott hauteclair</sub>](https://eliott.be)<br />[🌍](#translation-Eliottiosdevs "Translation") |
| [<img src="https://avatars3.githubusercontent.com/u/14539?v=4" width="100px;"/><br /><sub>Peter Blazejewicz</sub>](http://www.linkedin.com/in/peterblazejewicz)<br />[🌍](#translation-peterblazejewicz "Translation") | [<img src="https://avatars0.githubusercontent.com/u/6516758?v=4" width="100px;"/><br /><sub>Eric Adamski</sub>](https://github.com/ericadamski)<br />[🐛](https://github.com/gitpoint/git-point/issues?q=author%3Aericadamski "Bug reports") | [<img src="https://avatars2.githubusercontent.com/u/1559013?v=4" width="100px;"/><br /><sub>Jouderian Nobre Junior</sub>](https://github.com/jouderianjr)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jouderianjr "Code") | [<img src="https://avatars2.githubusercontent.com/u/5158502?v=4" width="100px;"/><br /><sub>Phi Dong</sub>](http://www.phidong.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=pdong "Code") | [<img src="https://avatars2.githubusercontent.com/u/17956698?v=4" width="100px;"/><br /><sub>John Patrick Salcedo</sub>](https://github.com/jpls93)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jpls93 "Code") | [<img src="https://avatars2.githubusercontent.com/u/11599942?v=4" width="100px;"/><br /><sub>Óscar Carretero</sub>](https://github.com/ocarreterom)<br />[💻](https://github.com/gitpoint/git-point/commits?author=ocarreterom "Code") |
| [<img src="https://avatars3.githubusercontent.com/u/5528931?v=4" width="100px;"/><br /><sub>Dyesse YUMBA</sub>](https://github.com/dyesseyumba)<br />[🔧](#tool-dyesseyumba "Tools") | [<img src="https://avatars0.githubusercontent.com/u/20456165?v=4" width="100px;"/><br /><sub>Bink</sub>](https://binkpitch.me/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=binkpitch "Code") | [<img src="https://avatars2.githubusercontent.com/u/10085841?v=4" width="100px;"/><br /><sub>khvilaboa</sub>](https://github.com/khvilaboa)<br />[🌍](#translation-khvilaboa "Translation") | [<img src="https://avatars1.githubusercontent.com/u/40802?v=4" width="100px;"/><br /><sub>James Glover</sub>](http://jamesmglover.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jglover "Code") | [<img src="https://avatars2.githubusercontent.com/u/3025600?v=4" width="100px;"/><br /><sub>Jose Luis Naranjo</sub>](https://co.linkedin.com/in/josenaranjo/en)<br /> |
| [<img src="https://avatars3.githubusercontent.com/u/5528931?v=4" width="100px;"/><br /><sub>Dyesse YUMBA</sub>](https://github.com/dyesseyumba)<br />[🔧](#tool-dyesseyumba "Tools") | [<img src="https://avatars0.githubusercontent.com/u/20456165?v=4" width="100px;"/><br /><sub>Bink</sub>](https://binkpitch.me/)<br />[💻](https://github.com/gitpoint/git-point/commits?author=binkpitch "Code") | [<img src="https://avatars2.githubusercontent.com/u/10085841?v=4" width="100px;"/><br /><sub>khvilaboa</sub>](https://github.com/khvilaboa)<br />[🌍](#translation-khvilaboa "Translation") | [<img src="https://avatars1.githubusercontent.com/u/40802?v=4" width="100px;"/><br /><sub>James Glover</sub>](http://jamesmglover.com)<br />[💻](https://github.com/gitpoint/git-point/commits?author=jglover "Code") [⚠️](https://github.com/gitpoint/git-point/commits?author=jglover "Tests") | [<img src="https://avatars2.githubusercontent.com/u/3025600?v=4" width="100px;"/><br /><sub>Jose Luis Naranjo</sub>](https://co.linkedin.com/in/josenaranjo/en)<br /> |
<!-- ALL-CONTRIBUTORS-LIST:END -->
File renamed without changes.
47 changes: 47 additions & 0 deletions __tests__/data/api/notification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export const notification = {
id: '1',
repository: {
id: 1296269,
owner: {
login: 'octocat',
id: 1,
avatar_url: 'https://github.com/images/error/octocat_happy.gif',
gravatar_id: '',
url: 'https://api.github.com/users/octocat',
html_url: 'https://github.com/octocat',
followers_url: 'https://api.github.com/users/octocat/followers',
following_url:
'https://api.github.com/users/octocat/following{/other_user}',
gists_url: 'https://api.github.com/users/octocat/gists{/gist_id}',
starred_url:
'https://api.github.com/users/octocat/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/octocat/subscriptions',
organizations_url: 'https://api.github.com/users/octocat/orgs',
repos_url: 'https://api.github.com/users/octocat/repos',
events_url: 'https://api.github.com/users/octocat/events{/privacy}',
received_events_url:
'https://api.github.com/users/octocat/received_events',
type: 'User',
site_admin: false,
},
name: 'Hello-World',
full_name: 'octocat/Hello-World',
description: 'This your first repo!',
private: false,
fork: false,
url: 'https://api.github.com/repos/octocat/Hello-World',
html_url: 'https://github.com/octocat/Hello-World',
},
subject: {
title: 'Greetings',
url: 'https://api.github.com/repos/octokit/octokit.rb/issues/123',
latest_comment_url:
'https://api.github.com/repos/octokit/octokit.rb/issues/comments/123',
type: 'Issue',
},
reason: 'subscribed',
unread: true,
updated_at: '2014-11-07T22:01:45Z',
last_read_at: '2014-11-07T22:01:45Z',
url: 'https://api.github.com/notifications/threads/1',
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion __tests__/data/label.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
name: 'test tag',
name: 'test label text',
color: 'c3c3c3',
};
4 changes: 2 additions & 2 deletions __tests__/tests/components/EntityInfo.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { shallow } from 'enzyme';

import organization from '../../data/organization';
import user from '../../data/user';
import organization from 'testData/api/organization';
import user from 'testData/api/user';

import { EntityInfo } from 'components';

Expand Down
6 changes: 3 additions & 3 deletions __tests__/tests/components/LabelButton.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import { shallow } from 'enzyme';

import label from '../../data/label';
import label from 'testData/label';

import { LabelButton } from 'components';

describe('<LabelButton />', () => {
it('correctly renders small style', () => {
const wrapper = shallow(<LabelButton label={label} />);

expect(wrapper.prop('title')).toEqual('test tag');
expect(wrapper.prop('title')).toEqual(label.name);
expect(wrapper.prop('fontSize')).toEqual(12);
expect(wrapper.prop('color')).toEqual('#000000');
expect(wrapper.prop('backgroundColor')).toEqual('#c3c3c3');
Expand All @@ -19,7 +19,7 @@ describe('<LabelButton />', () => {
it('correctly renders large style', () => {
const wrapper = shallow(<LabelButton label={label} largeWithTag />);

expect(wrapper.prop('title')).toEqual('test tag');
expect(wrapper.prop('title')).toEqual(label.name);
expect(wrapper.prop('fontSize')).toEqual(13);
expect(wrapper.prop('color')).toEqual('#000000');
expect(wrapper.prop('backgroundColor')).toEqual('#c3c3c3');
Expand Down
4 changes: 2 additions & 2 deletions __tests__/tests/components/StateBadge.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { shallow } from 'enzyme';

import { closed as closedIssue, open as openIssue } from '../../data/issue';
import { closed as closedIssue, open as openIssue } from 'testData/api/issue';
import {
closed as closedPr,
open as openPr,
merged as mergedPr,
} from '../../data/pull-request';
} from 'testData/api/pull-request';
import { colors } from 'config';

import { StateBadge } from 'components';
Expand Down
Loading

0 comments on commit 3c78a80

Please sign in to comment.