Update Calendar Tests
Let's update dashboard tests to add the tests for the calendar functionalities.
We'll cover the following...
Below is our updated code. Use this to make further changes mentioned in the lesson.
your_API_key
Not Specified...
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>LetsGetLunch</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> </head> <body> <app-root></app-root> </body> </html>
Updated dashboard calendar
Let’s update our tests now that our events are populated within the calendar.
- Add two spies for our new
addJSDate
andaddEventColors
methods, chaining them with.callThrough()
to allow the implementation to run.
Press + to interact
// src/app/dashboard/dashboard.component.spec.tsbeforeEach(() => {fixture = TestBed.createComponent(DashboardComponent);component = fixture.componentInstance;authService = fixture.debugElement.injector.get(AuthService);eventsService = fixture.debugElement.injector.get(EventsService);spyOn(component, 'addJSDate').and.callThrough();spyOn(component, 'addEventColors').and.callThrough();fixture.detectChanges();});
- Now update our initialization test. Leverage our two spies to verify that the functions have been called when a collection of users have been