You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More and more I find myself mixing harnesses and spectator.
Spectator is great for setting up dependencies and reducing Testbed boilerplate, while harnesses are great at abstracting away the logic behind UI elements.
For example, if you have a date picker component, you can hide its implementation details so that your tests look like this:
constbirthday=awaitloader.getHarness(MyDatePickerHarness.with({label: 'When were you born?'});awaitbirthday.pickDate('1989-09-18');
It's not this is impossible to do this utility functions and spectator, but it's just cleaner with harnesses.
So maybe spectator could have something to make it easier to work with harnesses? For example instead of doing:
letloader: HarnessLoader;beforeEach(()=>{// create componentloader=TestbedHarnessEnvironment.loader(spectator.fixture);});it('allows user to specify birthday',async()=>{constbirthday=awaitloader.getHarness(MyDatePickerHarness.with({label: 'When were you born?'});awaitbirthday.pickDate('1989-09-18');});
we could have spectator.loader be automatically available:
beforeEach(()=>{// create component});it('allows user to specify birthday',async()=>{constbirthday=awaitspectator.loader.getHarness(MyDatePickerHarness.with({label: 'When were you born?'});awaitbirthday.pickDate('1989-09-18');});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
More and more I find myself mixing harnesses and spectator.
Spectator is great for setting up dependencies and reducing Testbed boilerplate, while harnesses are great at abstracting away the logic behind UI elements.
For example, if you have a date picker component, you can hide its implementation details so that your tests look like this:
It's not this is impossible to do this utility functions and spectator, but it's just cleaner with harnesses.
So maybe spectator could have something to make it easier to work with harnesses? For example instead of doing:
we could have
spectator.loaderbe automatically available:or just have
getHarnessright there.Beta Was this translation helpful? Give feedback.
All reactions