Comments (6)
then there's no reason to change code in the library, you can assert value by expect(component.writeValue).toHaveBeenCalledWith(expectedValue)
. The idea of mocks is to isolate the behavior of the object you want to replace the other objects by mocks that simulate the behavior of the real objects. And how to simulate the behavior should be defined by developer, not by library. So if you want to set value
property when writeValue
has been called you should use callFake
to achieve your goals.
from ng-mocks.
Hi,
are you sure you shouldn't assert call of writeValue with proper arguments?
from ng-mocks.
@satanTime, this was written as a state test, I don't see value in checking writeValue call because the end result is what I'm interested in, not how it's achieved. Feel free to add any other asserts or tests if that's part of the pattern you follow. I just want it to be in release so that tests from parent component that verify custom components value from form is possible (check formControl bindings)
from ng-mocks.
Could you provide code of exact test case you try to solve?
from ng-mocks.
@satanTime, it's the one that's in the PR
from ng-mocks.
Really, that makes perfect sense. :)
Consider the issue to be closed then.
from ng-mocks.
Related Issues (20)
- docs: a16 id check HOT 1
- Extension methods for MockBuilder HOT 11
- Potential memory leak? HOT 6
- Feature Request: Documentation to unit test functional router guard HOT 3
- Bug: `MockModule`, `NgFor` and `@happy-dom/jest-environment` HOT 10
- Bug: Mocking a component declared in a module imported in a standalone component leads to a duplicate declaration exception HOT 1
- Bug: MockBuilder doesn't detect kept modules in standalone components HOT 1
- Feature Request: docs about how to mock dependencies in initialization logic HOT 1
- Testing components using injection tokens (multi) HOT 1
- Bug: "component threw errors during cleanup" with Angular Material HOT 2
- Bug: mockComponent of standalone component breaks ngIf HOT 4
- Feature Request: cover MatStepper HOT 2
- Bug: Unable to mock providers of a standalone component HOT 4
- Bug: mock observables with ease
- Bug:
- Bug:
- Bug: `RangeError: Maximum call stack size exceeded` when encountering circular reference in component imported using `forwardRef` HOT 2
- Feature Request: Replace Angular Testbed based spec schematics HOT 3
- Docs: Rename testing guide NGRS to NGXS HOT 2
- Bug: ngMocks.globalReplace() doesn't work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-mocks.