Skip to content

Feature request: .change/.increases etc with a function for value #544

Description

@elado

// chai-change plugin doesn't seem to work anymore (chaijs/chai-change#4)

Seems like assertChanges in assertions.js expects object, prop. It limits the usage of this kind of assertion, as I can't do:

assert.increases(
  someOperation,
  () => getSomething().length
)

It's good in cases I use immutable data, and getSomething returns different object completely.

RSpec's change matcher has this feature, it can get either an object and a method name or a function for more arbitrary operations.

https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/change-matcher

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions