Git Product home page Git Product logo

referee-more-assertions's Introduction

referee-more-assertions

Additional assertions for referee.

Matchers

At the moment, only matchers for arrays and array-like objects are provided.

Array / Sequence Matchers

Contains by Identity (===)

Similar to assert.contains, the following assertions are provided:

  • assert.containsOnce(array, element) passes if array contains element exactly once.

  • assert.containsInOrder(array, a, b, c, ...) passes if array contains all passed-in values in that order.

Contains by Match

The following assertions check for matching elements. See the documentation of assert.match to understand how referee matches.

  • assert.containsMatch(array, matcher) passes if any element in array matches matcher.

  • assert.containsMatchOnce(array, matcher) passes if exactly one element in array matches matcher.

  • assert.containsMatchesInOrder(array, matcherA, matcherB, ...) passes if elements matching the passed-in matchers are contained in the given order.

Contains by Equality

These assertions check sequence elements by equality. Read the documentation of assert.equals to understand how referee checks for equality.

  • assert.containsEqual(array, value) passes if any element in array equals value.

  • assert.containsEqualOnce(array, value) passes if exactly one element in array equals value.

  • assert.containsEqualsInOrder(array, valueA, valueB, ...) passes if elements equaling the passed-in values are contained in the given order.

Contains Substring

This assertion checks whether a string (or string representation of an object) contains a substring.

Contribute

Contributions welcome! Please make sure that your assertion functions are properly tested. Don’t test assert.myAssert(), but only the assertion function.

referee-more-assertions's People

Contributors

davidaurelio avatar

Stargazers

HIRAKI Satoru avatar azu avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.