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

Rework "requires" helper to support context and seeding of additional parameters #126

Open
jonathandavidson opened this issue Aug 5, 2015 · 0 comments

Comments

@jonathandavidson
Copy link

In order to accommodate testing functions with more than one parameter, as well as functions that need to be called in a specific context, the requires helper will be modified to be used in the following way:

const assertions = requires( subject.functionUnderTest, subject )
    .arg(1).set( 'seed value 1'  )
    .arg(2).set( 'seed value 2'  )
    .arg(3).accepts( ‘object’, ‘array’ );

With the above example, the return value would be something similar to:

[
    { passed: true, message: 'object should not be accepted' },
    { passed: false, message: 'array should be accepted' },
    { passed: false, message: 'string should be accepted' }
]

This return value can then be iterated to form the assertions in whatever testing library is being used.

Closes #58
Closes #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants