How to use the expect/build/jasmineUtils.equals function in expect

To help you get started, we’ve selected a few expect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jonasholtkamp / jest-when-xt / src / when.js View on Github external
// Propagate failure to the end
  if (!match) {
    return false
  }

  const arg = args[i]

  logger.debug(`   matcher: ${matcher}`)
  logger.debug(`   arg: ${arg}`)

  // Assert the match for better messaging during a failure
  if (assertCall) {
    expect(arg).toEqual(matcher)
  }

  return utils.equals(arg, matcher)
}
class WhenMock {
github jest-community / jest-extended / src / utils / index.js View on Github external
  return list.findIndex(item => equals(item, value)) > -1;
};
github phongnd39 / cypress-jest-adapter / src / utils / matchers.js View on Github external
toHaveBeenNthCalledWith(nth, ...expected) {
      const received = utils.flag(this, 'object')
      const nthCall = received.getCall(nth - 1)
      this.assert(
        equals(nthCall.args, expected),
        `expected spy ${nth} to have been called with arguments #{exp}, actual [${
          nthCall.args
        }]`,
        `expected spy ${nth} not to have been called with arguments #{exp}, actual [${
          nthCall.args
        }]`,
        expected
      )
    },
    toHaveReturned() {
github phongnd39 / cypress-jest-adapter / src / utils / matchers.js View on Github external
        calls.some(call => equals(call.returnValue, expected)),
        `expected spy to have returned #{exp} at least once`,
github phongnd39 / cypress-jest-adapter / src / utils / matchers.js View on Github external
toHaveNthReturnedWith(nth, expected) {
      const received = utils.flag(this, 'object')
      const nthCall = received.getCall(nth - 1)
      this.assert(
        equals(nthCall.returnValue, expected),
        `expected spy ${nth} to have returned #{exp}, actual [${nthCall.args}]`,
        `expected spy ${nth} not to have returned #{exp}, actual [${
          nthCall.args
        }]`,
        expected
      )
    },
    toBe(expected) {
github phongnd39 / cypress-jest-adapter / src / utils / matchers.js View on Github external
        calls.some(call => equals(call.args, expected)),
        `expected spy to have been called with arguments #{exp} at least once`,
github jonasholtkamp / jest-when-xt / src / when.js View on Github external
        .filter((callMock) => once || callMock.once || !utils.equals(callMock.matchers, matchers))
        .concat({ matchers, val, assertCall, once })
github jonasholtkamp / jest-when-xt / src / when.js View on Github external
this.callMocks = this.callMocks.filter(mock => {
              if (mock.once && utils.equals(mock.matchers, matchers) && !removedOneItem) {
                removedOneItem = true
                return false
              }
              return true
            })
            return val

expect

This package exports the `expect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect).

MIT
Latest version published 1 year ago

Package Health Score

88 / 100
Full package analysis