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
export interface State { | |
customers: Customer[]; | |
} | |
const initialState = { | |
customers: [] | |
} |
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
export interface State { | |
loadStatus: 'NOT_LOADED' | 'LOADING' | 'LOADED'; | |
customers: Customer[]; | |
} | |
const initialState = { | |
loadStatus: 'NOT_LOADED', | |
customers: [] | |
} |
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
@Injectable() | |
export class CustomerEffects { | |
private baseUrl = 'https://local.eternal.com/api/customer'; | |
constructor( | |
private actions$: Actions, | |
private http: HttpClient, | |
private router: Router | |
) {} | |
loadCustomers$ = createEffect(() => |
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
export const customerFeatureKey = 'Customer'; | |
export interface State {customers: Customer[]} | |
export interface CustomerAppState { | |
[customerFeatureKey]: State; | |
} | |
export const initialState: State = {customers: []}; |
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
export interface Customer { | |
id: number; | |
firstname: string; | |
name: string; | |
country: string; | |
birthdate: 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
it('should fail', () => { | |
let isSuccessful = false; | |
cy.visit(''); | |
cy.get('button').click(); | |
cy.get('div.message').then(() => { | |
isSuccessful = true; | |
}); | |
if (!isSuccessful) { | |
throw new Error('something is not working'); |
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
it('should click on add customers', () => { | |
cy.visit('') | |
.then(() => cy.get('[data-test=btn-customers]')) | |
.then((button) => button.click()) | |
.then(() => cy.get('[data-test=btn-customers-add]')) | |
.then((button) => button.click()); | |
}); | |
it('should click on add customers', async () => { | |
await cy.visit(''); |
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
it("should click on add customers", () => { | |
cy.visit(""); | |
cy.get("[data-test=btn-customers]").click(); | |
cy.get("[data-test=btn-customers-add]").click(); | |
}) |
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
it("should add a customer", () => { | |
cy.visit(""); | |
cy.get("a").contains("Customers").click(); | |
cy.get("a").contains("Add Customer").click(); | |
}) |