Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Schematics): use ofType operator function instead of Actions#ofType #1154

Conversation

koumatsumoto
Copy link
Contributor

I suppose that we should use ofType operator function instead of Actions#ofType in generated files by schematics.
Please consider this change, thank you!

);
expect(content).toMatch(/export class FooEffects/);
expect(content).toMatch(
/effect\$ = this\.actions\$.pipe\(ofType<LoadFoos>\(FooActionTypes\.LoadFoos\)\);/
Copy link
Member

@timdeschryver timdeschryver Jun 26, 2018

Choose a reason for hiding this comment

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

Maybe rename effects$ to loadFoos$?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your comment!
I renamed "effect$" to "loadFoos$".
It's more suitable in this case.

@@ -37,7 +37,7 @@ describe('Effect Schematic', () => {
appTree = createWorkspace(schematicRunner, appTree);
});

it('should create an effect', () => {
it('should create an effect file and its spec file', () => {
Copy link
Member

Choose a reason for hiding this comment

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

This should be should create an effect with a spec file.

@@ -50,6 +50,44 @@ describe('Effect Schematic', () => {
).toBeGreaterThanOrEqual(0);
});

it('should create an effect class which has a "loadFoos$" property if feature is set', () => {
Copy link
Member

@timdeschryver timdeschryver Jun 27, 2018

Choose a reason for hiding this comment

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

This should be should create an effect that describes a source of actions within a feature.
And maybe move the test a bit down? (after the default tests)

);
});

it('should create an effect class which does not have a "loadFoos$" property if root is set', () => {
Copy link
Member

Choose a reason for hiding this comment

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

This should be should create an effect that does not define a source of actions within the root.
And maybe move the test a bit down? (after the default tests)

@MatsumotoKou
Copy link

@tdeschryver
Thank you for review and explaining!
I updated it, please continue your checks.

@Effect()
effect$ = this.actions$.ofType(<%= classify(name) %>ActionTypes.Load<%= classify(name) %>s);
loadFoos$ = this.actions$.pipe(ofType<Load<%= classify(name) %>s>(<%= classify(name) %>ActionTypes.Load<%= classify(name) %>s));
<% } %>
Copy link
Member

Choose a reason for hiding this comment

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

Remove the <Load<%= classify(name) %>s>

@koumatsumoto koumatsumoto force-pushed the update-effect-schematics-with-of-type-operator-function branch from beec706 to 851bf21 Compare June 29, 2018 12:03
@coveralls
Copy link

Coverage Status

Coverage increased (+0.1%) to 88.221% when pulling 851bf21 on kouMatsumoto:update-effect-schematics-with-of-type-operator-function into 221020a on ngrx:master.

@koumatsumoto
Copy link
Contributor Author

@brandonroberts
Thank you for the pointing out!
I update it, please continue your review.

@brandonroberts brandonroberts merged commit cb58ff1 into ngrx:master Jun 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants