Code Monkey home page Code Monkey logo

Comments (4)

XoNoXForce avatar XoNoXForce commented on May 27, 2024 1

I think that the best thing to do, it's to move the logic in the service layer. The Domain layer duties in my mind are strictly related to the trigger. That is tested through integration tests.
I'm used putting the logic that would change the object in the service layer, and then you can mock it.
I never had the need to mock the domain.

from fflib-apex-mocks.

dfruddffdc avatar dfruddffdc commented on May 27, 2024 1

Ah constructor mocking/spying. Unfortunately, I don't think this is possible in ApexMocks.
I've been using sinon in nodeJS and had similar issues.

The best I can suggest is having a domain factory method, where the tests create a real Domain instance and verify the records. And then route all of the Domain creation throughout your app through this factory, mocking it out in unit tests.

Closing as wontfix, I think it's just a limitation we have to accept.

from fflib-apex-mocks.

cropredyHelix avatar cropredyHelix commented on May 27, 2024

from fflib-apex-mocks.

afawcett avatar afawcett commented on May 27, 2024

@cropredyHelix yes, if its behavior of the object it can be included in the domain class, it's not a hard and fast rule though, at least if it's in or below the service layer we have logic in a safe place! 👍

from fflib-apex-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.