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
It looks like the MockComponent method does not setup methods from inherited methods. The code for setting up mock methods for both MockDirective and MockComponent only gets methods from the class's prototype but doesn't traverse up the prototype chain to handle inheritance.
For example, Angular Material's MatSidenav component extends the MatDrawer component and methods defined on MatDrawer are not setup when mocking MatSidenav. This can cause some confusion when some methods on a type are setup and others are not.
Neither MockComponent or MockDirective have any methods from the class's prototype. The mocked entities consist of strictly inputs & outputs. If you need further implementation detail in your mock then in your test you can query for the mocked entity and extend the instance using either a mocking framework or by plain old assignment.
It looks like the
MockComponent
method does not setup methods from inherited methods. The code for setting up mock methods for both MockDirective and MockComponent only gets methods from the class's prototype but doesn't traverse up the prototype chain to handle inheritance.For example, Angular Material's MatSidenav component extends the MatDrawer component and methods defined on MatDrawer are not setup when mocking MatSidenav. This can cause some confusion when some methods on a type are setup and others are not.
Here's a small stackblitz that reproduces the error
The text was updated successfully, but these errors were encountered: