Giter VIP home page Giter VIP logo

Comments (6)

satanTime avatar satanTime commented on May 10, 2024 1

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.

satanTime avatar satanTime commented on May 10, 2024

Hi,

are you sure you shouldn't assert call of writeValue with proper arguments?

from ng-mocks.

privettoli avatar privettoli commented on May 10, 2024

@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.

satanTime avatar satanTime commented on May 10, 2024

Could you provide code of exact test case you try to solve?

from ng-mocks.

privettoli avatar privettoli commented on May 10, 2024

@satanTime, it's the one that's in the PR

from ng-mocks.

privettoli avatar privettoli commented on May 10, 2024

Really, that makes perfect sense. :)
Consider the issue to be closed then.

from ng-mocks.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.