Skip to content

Commit bbb7e8c

Browse files
koumatsumotobrandonroberts
authored andcommitted
fix(schematics): correct a type of action class generated (#1140)
1 parent 6cf99f1 commit bbb7e8c

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

modules/schematics/src/action/files/__name@dasherize@if-flat__/__name@dasherize__.actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export enum <%= classify(name) %>ActionTypes {
44
Load<%= classify(name) %>s = '[<%= classify(name) %>] Load <%= classify(name) %>s'
55
}
66

7-
export class <%= classify(name) %> implements Action {
7+
export class Load<%= classify(name) %>s implements Action {
88
readonly type = <%= classify(name) %>ActionTypes.Load<%= classify(name) %>s;
99
}
1010

modules/schematics/src/action/index.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,32 @@ describe('Action Schematic', () => {
6969
expect(fileContent).toMatch(/export enum FooActionTypes/);
7070
});
7171

72+
it('should create a class based on the provided name', () => {
73+
const tree = schematicRunner.runSchematic(
74+
'action',
75+
defaultOptions,
76+
appTree
77+
);
78+
const fileContent = tree.readContent(
79+
`${projectPath}/src/app/foo.actions.ts`
80+
);
81+
82+
expect(fileContent).toMatch(/export class LoadFoos implements Action/);
83+
});
84+
85+
it('should create the union type based on the provided name', () => {
86+
const tree = schematicRunner.runSchematic(
87+
'action',
88+
defaultOptions,
89+
appTree
90+
);
91+
const fileContent = tree.readContent(
92+
`${projectPath}/src/app/foo.actions.ts`
93+
);
94+
95+
expect(fileContent).toMatch(/export type FooActions = LoadFoos/);
96+
});
97+
7298
it('should group within an "actions" folder if group is set', () => {
7399
const tree = schematicRunner.runSchematic(
74100
'action',

0 commit comments

Comments
 (0)