-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a3bc534
commit 0961ff3
Showing
10 changed files
with
76 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 2 additions & 7 deletions
9
projects/angular-ngrx-material-starter/src/app/features/examples/crud/books.actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
import { createAction, props } from '@ngrx/store'; | ||
import { Book } from './books.model'; | ||
|
||
export enum BookActionTypes { | ||
UPSERT_ONE = '[Books] Upsert One', | ||
DELETE_ONE = '[Books] Delete One' | ||
} | ||
|
||
export const actionBooksUpsertOne = createAction( | ||
BookActionTypes.UPSERT_ONE, | ||
'[Books] Upsert One', | ||
props<{ book: Book }>() | ||
); | ||
|
||
export const actionBooksDeleteOne = createAction( | ||
BookActionTypes.DELETE_ONE, | ||
'[Books] Delete One', | ||
props<{ id: string }>() | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 2 additions & 7 deletions
9
projects/angular-ngrx-material-starter/src/app/features/examples/form/form.actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
import { createAction, props } from '@ngrx/store'; | ||
import { Form } from './form.model'; | ||
|
||
export enum FormActionTypes { | ||
UPDATE = '[Form] Update', | ||
RESET = '[Form] Reset' | ||
} | ||
|
||
export const actionFormUpdate = createAction( | ||
FormActionTypes.UPDATE, | ||
'[Form] Update', | ||
props<{ form: Form }>() | ||
); | ||
|
||
export const actionFormReset = createAction(FormActionTypes.RESET); | ||
export const actionFormReset = createAction('[Form] Reset'); |
45 changes: 45 additions & 0 deletions
45
...ngrx-material-starter/src/app/features/examples/stock-market/stock-market.actions.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { | ||
actionStockMarketRetrieve, | ||
actionStockMarketRetrieveError, | ||
actionStockMarketRetrieveSuccess | ||
} from './stock-market.actions'; | ||
import { Stock } from './stock-market.model'; | ||
import { HttpErrorResponse } from '@angular/common/http'; | ||
|
||
const symbol = 'TSLA'; | ||
|
||
describe('Stock Market Actions', () => { | ||
it('should create StockMarketRetrieve action', () => { | ||
const action = actionStockMarketRetrieve({ symbol }); | ||
expect(action.type).toEqual(actionStockMarketRetrieve.type); | ||
expect(action.symbol).toEqual(symbol); | ||
}); | ||
|
||
it('should create StockMarketRetrieveSuccess action', () => { | ||
const stock: Stock = { | ||
symbol, | ||
exchange: 'exchange', | ||
last: '42', | ||
ccy: 'USD', | ||
change: 'change', | ||
changePositive: true, | ||
changeNegative: false, | ||
changePercent: '2.00' | ||
}; | ||
const action = actionStockMarketRetrieveSuccess({ stock }); | ||
expect(action.type).toEqual(actionStockMarketRetrieveSuccess.type); | ||
expect(action.stock).toEqual( | ||
jasmine.objectContaining({ | ||
...stock | ||
}) | ||
); | ||
}); | ||
|
||
it('should create StockMarketRetrieveError action', () => { | ||
const error = new HttpErrorResponse({}); | ||
const action = actionStockMarketRetrieveError({ error: error }); | ||
|
||
expect(action.type).toEqual(actionStockMarketRetrieveError.type); | ||
expect(action.error).toEqual(error); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/angular-ngrx-material-starter/src/app/features/examples/todos/todos.actions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters