-
-
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): fixed the schematics/action spec template #2092
Conversation
Preview docs changes for cdded0d at https://previews.ngrx.io/pr2092-cdded0d/ |
|
||
describe('<%= classify(name) %>', () => { | ||
it('should create an instance', () => { | ||
expect(new <%= classify(name) %>()).toBeTruthy(); | ||
expect(new from<%= classify(name)%>.Load<%= classify(name) %>s()).toBeTruthy(); |
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.
Can you add a test for this?
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 sure. The new test will check for the content generated by the action spec schematics?
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.
Correct, for example
expect(fileContent).toMatch(/export class LoadFoos implements Action/); |
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 have added the tests Tim. Can you check them ?
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(new from<%= classify(name)%>.Load<%= classify(name) %>s()).toBeTruthy(); | |
expect(new<%= classify(name)%>Actions.Load<%= classify(name) %>s()).toBeTruthy(); |
Preview docs changes for d065a55 at https://previews.ngrx.io/pr2092-d065a55/ |
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 👍
@@ -1,7 +1,7 @@ | |||
import { <%= classify(name) %> } from './<%= dasherize(name) %>.actions'; | |||
import * as from<%= classify(name) %> from './<%= dasherize(name) %>.actions'; |
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.
import * as from<%= classify(name) %> from './<%= dasherize(name) %>.actions'; | |
import * as <%= classify(name) %>Actions from './<%= dasherize(name) %>.actions'; |
|
||
describe('<%= classify(name) %>', () => { | ||
it('should create an instance', () => { | ||
expect(new <%= classify(name) %>()).toBeTruthy(); | ||
expect(new from<%= classify(name)%>.Load<%= classify(name) %>s()).toBeTruthy(); |
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(new from<%= classify(name)%>.Load<%= classify(name) %>s()).toBeTruthy(); | |
expect(new<%= classify(name)%>Actions.Load<%= classify(name) %>s()).toBeTruthy(); |
`${projectPath}/src/app/foo.actions.spec.ts` | ||
); | ||
|
||
expect(fileContent).toMatch(/expect\(new fromFoo.LoadFoos\(\)\)/); |
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(fileContent).toMatch(/expect\(new fromFoo.LoadFoos\(\)\)/); | |
expect(fileContent).toMatch(/expect\(new FooActions.LoadFoos\(\)\)/); |
Preview docs changes for d6af3ca at https://previews.ngrx.io/pr2092-d6af3ca/ |
Thanks @agugan! |
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?
when you use the action schematic to generate an action unit test without creators, you get a failing unit test because of the wrong imports.
Closes #2082
What is the new behavior?
Modified the spec template to properly import the actions and also uses the correct class template inside the test suites
Does this PR introduce a breaking change?
Other information