Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akalongman committed Jan 21, 2021
1 parent 8a1b3a8 commit d34d71e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/Unit/Http/Resources/ArrayResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,22 @@ public function it_should_transform_array(): void
$this->assertInstanceOf(JsonResponse::class, $response);
$this->assertSame($expected, $response->content());
}

/** @test */
public function it_should_return_unecaped_json(): void
{
$resource = new ArrayResource([
'aa' => 'ერთი',
'aa2' => 'ორი',
'aa3' => 'სამი',
]);

$request = app(Request::class);
$response = $resource->additional(['custom' => '1'])->withResourceType('customType')->toResponse($request);

$expected = '{"data":{"id":null,"type":"customType","attributes":{"aa":"ერთი","aa2":"ორი","aa3":"სამი"}},"custom":"1"}';

$this->assertInstanceOf(JsonResponse::class, $response);
$this->assertSame($expected, $response->content());
}
}

0 comments on commit d34d71e

Please sign in to comment.