Skip to content

alwaysCalledWithExactly is not a function #139

@hovissimo

Description

@hovissimo

My error: (...).to.have.been.alwaysCalledWith is not a function

My code

 it("fires props.togglePurchasable with id when clicked", function() {                     
   const props = cloneDeep(baseProps);                                                     
                                                                                           
   const wrapper = shallow(<StoreFrontPurchasable {...props} />);                          
                                                                                           
   wrapper.find("button").simulate("click");                                               
   wrapper.find("button").simulate("click");                                               
   wrapper.find("button").simulate("click");                                               
                                                                                           
   expect(props.togglePurchasable.callCount).to.equal(3);                                  
   expect(props.togglePurchasable).to.have.been.alwaysCalledWithExactly(props.purchasable.id);    
 });                                                                                       

My versions: chai: 3.5.0 sinon:7.2.2 sinon-chai:3.3.0

I get the same result when I try to use alwaysCalledWith, but I don't have any problem using calledWith or calledWithExactly (except of course that they're not the assertion I need).

I noticed that alwaysCalledWith and alwaysCalledWithExactly are missing from the bottom of lib/sinon-chai.js, is this a coincidence? alwaysCalledWith and alwaysCalledWithExactly are listed in the README, so I assume they should be available.

https://github.com/domenic/sinon-chai/blob/fb4f82a684db5aad277163943ae4c6732b5d7a22/lib/sinon-chai.js#L131-L148

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions