Skip to content

test: added tests for notifications reducer#567

Merged
andrewda merged 8 commits into
gitpoint:masterfrom
jglover:add-notifications-reducer-tests
Oct 25, 2017
Merged

test: added tests for notifications reducer#567
andrewda merged 8 commits into
gitpoint:masterfrom
jglover:add-notifications-reducer-tests

Conversation

@jglover

@jglover jglover commented Oct 23, 2017

Copy link
Copy Markdown
Contributor

Added tests for notifications reducer. This revealed a few problems with the reducer that I'll address in an issue.

@jglover jglover mentioned this pull request Oct 23, 2017
63 tasks

@alejandronanez alejandronanez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @jglover thanks for this PR, I think it's pretty clear and well written.
I have 2 things I'd like to see changed here:

  • Try not to use relative imports
  • Avoid nested describes for your tests

Besides that, LGTM.


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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we can use absolute imports instead of relative imports? Relative imports can get messy pretty quick.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This occurred to me, I'll update it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm we're still using relative imports here.

@@ -0,0 +1,475 @@
import React from 'react';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally speaking, I agree with @andrewda about not nesting describes, that can get quite messy pretty quickly.
I think one describe per test suite is fine and just using it clauses should be enough for describing a good test suite. Can you please flatten your tests so you only use 1 describe and multiple it statements?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure

import { notification } from '../../data/api/notification';
import { authError } from '../../data/api/error';

describe('Notifications reducer', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use title case: "Notifications Reducer".

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+3.1%) to 32.873% when pulling f6f8445 on jglover:add-notifications-reducer-tests into 5e33fee on gitpoint:master.

jglover added a commit to jglover/git-point that referenced this pull request Oct 24, 2017
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+3.004%) to 33.719% when pulling 6653325 on jglover:add-notifications-reducer-tests into 0f7accc on gitpoint:master.

@jglover

jglover commented Oct 25, 2017

Copy link
Copy Markdown
Contributor Author

@alejandronanez @andrewda The requested changes have been made :)


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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm we're still using relative imports here.

open as openPr,
merged as mergedPr,
} from '../../data/pull-request';
} from '../../data/api/pull-request';

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we're using relative imports here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are just tests I touched when I moved the test data files, my discipline tells me update all tests in a different PR but I'll do it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alejandronanez all references updated to use alias instead of absolute paths.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+3.0%) to 33.832% when pulling c100519 on jglover:add-notifications-reducer-tests into a43d3bc on gitpoint:master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+3.0%) to 33.832% when pulling c100519 on jglover:add-notifications-reducer-tests into a43d3bc on gitpoint:master.

@jglover

jglover commented Oct 25, 2017

Copy link
Copy Markdown
Contributor Author

@alejandronanez updated paths to use alias instead of absolute paths across all tests.

@alejandronanez alejandronanez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jglover !

@andrewda andrewda merged commit 3c78a80 into gitpoint:master Oct 25, 2017
@andrewda

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants