#Testing PRIVATE method through PUBLIC method

11 messages · Page 1 of 1 (latest)

flint void
#

@glad tangle do you know how? thank you in advance

glad tangle
#

g!rule4 @flint void

grizzled domeBOT
#

@flint void, please take a moment to go over our #rules. Do not send unsolicited Discord notifications. The use of @everyone and @here is strictly forbidden. Unsolicited direct messages (DMs), mentions, or friend requests are not allowed unless permission is granted in public channels. Replies to previous messages are allowed.

glad tangle
#

Don't call Angular lifecycle hooks yourself. The TestBed fixture will call them for you. Just check the results

shrewd temple
#

This is part of a component or directive. You shouldn't test "methods", IMHO. You should test that the component behaves as it should behave.

flint void
shrewd temple
#

Should the component display some message or data or sub component? Then test that it displays the message or data or sub component.

glad tangle
#
it('should create Component', (): void => {
  expect(component.contentHost) // ...
});
flint void
shrewd temple
#

If you don't know what the component is supposed to do, then you're not the one who should be testing it.

flint void
#

I was just asked to test the private function by testing the public function that calls the private one