Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better spy assertion errors #715

Closed
imjacobclark opened this issue May 30, 2016 · 1 comment
Closed

Better spy assertion errors #715

imjacobclark opened this issue May 30, 2016 · 1 comment

Comments

@imjacobclark
Copy link

When the following is not satisfied:

it('should call response.header with expected arguments', function(){
    let response = chai.spy.object([ 'header' ]);
    let responseBuilder = new ResponseBuilder(response);

    responseBuilder
        .addHeaderByKeyValue('Access-Control-Allow-Origin', '*')
        .build({});

    expect(response.header).to.have.been.called.with({
        'Access-Control-Allow-Origin': '*'
    });
});

It yields the below error:

AssertionError: expected { Spy 'object.header', 1 call } to have been called with [ Array(1) ]

This is not particularly helpful in seeing where the assertion actually failed, whilst the above error is correct, is there any mechanism or switch to make this more 'verbose'? If not, could this be a feature request?

@meeber
Copy link
Contributor

meeber commented May 30, 2016

@imjacobclark Gonna close this here since it's specific to chai-spies, but let's discuss over on chaijs/chai-spies#52

@meeber meeber closed this as completed May 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants