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

What do '*', '&' and '?' do #407

Open
SlickNutter opened this issue Oct 17, 2017 · 1 comment
Open

What do '*', '&' and '?' do #407

SlickNutter opened this issue Oct 17, 2017 · 1 comment

Comments

@SlickNutter
Copy link
Contributor

What effect do they have on .expect()?
I'm trying to check the calls response, but

frisby
    .post(url, postData)
    .expect('json', '&', title)
    .then(function(res) {
                    // console.log(res.json);
})

I get this error:
AssertionError [ERR_ASSERTION]: 'LPweBw-2017' == 'Langwieriger Projekttitel wo etwas Betitelt wird.'

What happens in utils.withPath(path, response._body, jsonContainsAssertion(jsonChunk)) with the different paths?

@vlucas
Copy link
Owner

vlucas commented Oct 18, 2017

They are path modifiers - mainly for arrays and objects.

For instance, if your response has a data key that returns an array, and you want to see if at least one item in that array is something, you can use data.? as the path. If you want every item in the array to be checked for something, use data.*. Similarly, the ampersand & can be used to check each object key. This does need to be documented though :)

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