Skip to content

expect(spy).to.have.been.called.with always true #82

@xavicolomer

Description

@xavicolomer

"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"chai-spies": "^0.7.1",

Hi there,

I am testing a little ORM I created myself

I am having some problems testing the result of a spy on a promise, the test always passes, no matter what I put inside with, in the example below I just put null, although query should be called with a SELECT SQL sentence

Any suggestions?

it('test SQL',
    () => {
      Item.database = { query: queryReturnsInsert };

      const item = new Item();
      item.name = 'James';

      const spy = chai.spy.on(Item.database, 'query');

      item.save({ in: 'go' })
        .then(function() {
          expect(spy).to.have.been.called.with(null);
        });
    });

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