Skip to content

Match specific fields in a JSON (ignoring the others) #39

Closed
@javierseixas

Description

@javierseixas

Hello! Given a JSON like this:

{
    "id": "@string@",
    "title": "My Title",
    "short_description": "@string@",
    "campaign_start": "@string@",
    "campaign_end": "@string@",
    "status": "@integer@",
    "_links": "@wildcard@",
    "_embedded": {
        "account": {
            "id": "@string@",
            "name": "@string@",
            "society_name": "@string@",
            "_links": "@wildcard@"
        }
    }
}

I would like to check that title equals to "My Title", but I don't care about the other fields. There is any way to ignore them?
I want to do that because the structure of the expected JSON is already tested before, so if I could write something like following would make my features cleaner and focused on what I'm testing each scenario.

What I'm figuring out would be like this:

{
    "title": "My title",
    "@whatever@"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions