Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
thijskok committed Mar 7, 2024
1 parent 87df996 commit 587f884
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Node/Block/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -713,4 +713,18 @@ public function testLoad(): void

self::assertJsonStringEqualsJsonString($json, $doc->toJson());
}

public function testLoadWithUnknownNodeType(): void
{
$json = <<<'TXT'
{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"hello"},{"type":"unknown","attrs":{"id":"abc"}},{"type":"text","text":" "},{"type":"text","text":"world"}]}]}
TXT;
$data = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
$doc = Document::load($data);

$expectedOutput = <<<'TXT'
{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"hello"},{"type":"text","text":" "},{"type":"text","text":"world"}]}]}
TXT;
self::assertJsonStringEqualsJsonString($expectedOutput, $doc->toJson());
}
}

0 comments on commit 587f884

Please sign in to comment.