-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix(schematics): avoid lastIndexOf error while creating store schematics (#1659) #1666
Conversation
Preview docs changes for 3d06428 at https://previews.ngrx.io/pr1666-3d06428/ |
My 2 cents is if |
I think the name parameter should not be required. If you create a rootstate (--root) the name is definitely not used. For my part i wont write something that is not necessary. I have an open mind for other solutions. |
If that's the case then no it shouldn't be set as required, however the definition says its required, so therefore the schema interface needs to be updated to have |
Preview docs changes for 1f251ad at https://previews.ngrx.io/pr1666-1f251ad/ |
name: undefined, | ||
}; | ||
|
||
expect(function() { |
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.
expect(function() { | |
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.
Done.
} catch (err) { | ||
thrownError = err; | ||
} | ||
expect(thrownError).toBeDefined(); |
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.
expect(thrownError).toBeDefined(); | |
expect(() => { | |
schematicRunner.runSchematic('store', options, appTree); | |
}).toThrowError('Please provide a name for the feature state'); |
Also, remove the try catch
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.
Did this for my test now. There is another test "should fail if specified module does not exist" which use also the try catch
- should i change this too?
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.
Not in the PR, you can open up a new PR if you would like to
Preview docs changes for 1a70cc3 at https://previews.ngrx.io/pr1666-1a70cc3/ |
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.
LGTM 👍
fix(schematics): avoid lastIndexOf error while creating store schematics (#1659)
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Closes #1659
What is the new behavior?
Now its possible to create a store schematic without a name if its called with the "--root" flag, otherwise a name is necessary.
Does this PR introduce a breaking change?
Other information