You can unit test a transformer completely. For example
public function testTransformer()
{
// Note the make here, we don't store it in the database, we simply want a model object
$article = factory(Article::class)->make([
'title' => 'Something',
'slug' => 'something
]);
$transformer = new ArticleTransformer();
$transformedArticle = $transformer->transform($article):
$this->assertEquals('Something', transformedArticle->title);
$this->assertEquals('something', transformedArticle->slug);
}
This is just a basic example, but it should do the trick for you.
Testing the json structure is fine here since you only want to know if the correct fields are returned. You can use unit tests (like above) to test if the transformer is giving you the correct data, for example calculations or data transformations.
Let me know if you have any more questions ;)