COS301-SE-2021 / Kenzo-Workout-Suite

Kenzo Workout Suite is the workout customization tool that will allow users around the world to have full control in organizing their workouts. This app will allow users to follow workout plans, having the ability to tailor their own avatars, making workout sessions easy to follow and fun to participate in. Trainers/planners are able to fully customize models and will have the opportunity to be creative with the workouts they create. Workouts will be published in a public library where users will be able to pick their favourite ones. These workouts will have text-to-speech technology that will allow planners to explain exercises in workouts. Users will also have the option to export workouts in multiple formats: GIF, PNG, PDF.
2 stars 0 forks source link

Add Stubbing for Alert Creation #26

Closed Aztrixs closed 3 years ago

Aztrixs commented 3 years ago

Upon testing, I have discovered that without stubbing the actual alert create function, the tests will not run unless you are on the actual Karma browser, i.e. using just terminal.

To avoid such please add the following to all tests with alerts @JHFrost.

spyOn(alertController, "create").and.stub();

Where alertController is an instance of AlertController instantiated in your beforeEach.

i.e it('should fail to sign up an account as server is not responding.', async () => { spyOn(service, 'attemptSignUp').and.resolveTo(500); spyOn(component, "presentAlert").and.stub(); await component.signUp().catch(error=>{ expect(error).toEqual(new Error('Server is not responding.')); }); });

should be

it('should fail to sign up an account as server is not responding.', async () => { spyOn(service, 'attemptSignUp').and.resolveTo(500); spyOn(alertController, "create").and.stub(); spyOn(component, "presentAlert").and.stub(); await component.signUp().catch(error=>{ expect(error).toEqual(new Error('Server is not responding.')); }); });

JHFrost commented 3 years ago

Completed.