0

I have a signup API that returns a JSON response in this kind of format

{
    "meta": {
        //response metadata
    },
    "data": {
        //user object
    }
}

I want to test this response with AssertableJson but I'm only concerned about the user object.

How do I use AssertableJson only for the data property of the response?

I've tried something like this with no success

$response->data->assertJson(
            function(AssertableJson $json){
                $json->whereType('id', 'string')
                     ->where('email', 'email@gmail.com')
                     ->etc();
            }
        );
Melly
  • 675
  • 8
  • 24

0 Answers0