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

Path eq string comparison is not working #27

Closed
subeshb1 opened this issue Oct 15, 2020 · 2 comments
Closed

Path eq string comparison is not working #27

subeshb1 opened this issue Oct 15, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@subeshb1
Copy link
Owner

When comparing a string, in the response inside a path, the script throws an error

 jq: invalid JSON text passed to --argjson
Use jq --help for help with command-line options,
or see the jq manpage, or online docs  at https://stedolan.github.io/jq

Example:

[
    {
        "key": "value",
        "foo": "bar",
        "status": "ASTATUS"
    }
]

example test case:

 ...
    "testCases": {
        "get_status": {
            "path": "/programs/",
            "method": "GET",
            "description": "GET /programs",
            "expect": {
                "body": {
                    "path_eq": {
                        "[0].status": "MYSTATUS"
                    }
                }
            }
        }
    }

The reason the error arises is, an invalid string is passed to jq argson (without quotes) failing it to parse. https://github.com/subeshb1/api-test/blob/v0.3.2/api-test.sh#L389

Thanks, @badevos for reporting this!

@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.95. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@issue-label-bot issue-label-bot bot added the bug Something isn't working label Oct 15, 2020
@subeshb1
Copy link
Owner Author

Fixed by #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant