66use Illuminate \Support \Facades \Http ;
77use FiveamCode \LaravelNotionApi \Entities \Blocks \Block ;
88use FiveamCode \LaravelNotionApi \Entities \Blocks \BulletedListItem ;
9+ use FiveamCode \LaravelNotionApi \Entities \Blocks \Embed ;
910use FiveamCode \LaravelNotionApi \Entities \Blocks \HeadingOne ;
1011use FiveamCode \LaravelNotionApi \Entities \Blocks \HeadingThree ;
1112use FiveamCode \LaravelNotionApi \Entities \Blocks \HeadingTwo ;
@@ -99,7 +100,7 @@ public function it_returns_block_collection_with_children_as_correct_instances()
99100 $ blockChildrenCollection = $ blockChildren ->asCollection ();
100101 $ this ->assertContainsOnly (Block::class, $ blockChildrenCollection );
101102 $ this ->assertIsIterable ($ blockChildrenCollection );
102- $ this ->assertCount (8 , $ blockChildrenCollection );
103+ $ this ->assertCount (9 , $ blockChildrenCollection );
103104
104105 # check paragraph
105106 $ blockChild = $ blockChildrenCollection [0 ];
@@ -156,6 +157,14 @@ public function it_returns_block_collection_with_children_as_correct_instances()
156157 $ this ->assertEquals ('toggle ' , $ blockChild ->getType ());
157158 $ this ->assertFalse ($ blockChild ->hasChildren ());
158159 $ this ->assertEquals ('toggle_block ' , $ blockChild ->getContent ()->getPlainText ());
160+
161+ # check embed
162+ $ blockChild = $ blockChildrenCollection [8 ];
163+ $ this ->assertInstanceOf (Embed::class, $ blockChild );
164+ $ this ->assertEquals ('embed ' , $ blockChild ->getType ());
165+ $ this ->assertFalse ($ blockChild ->hasChildren ());
166+ $ this ->assertEquals ('Testcaption ' , $ blockChild ->getCaption ()->getPlainText ());
167+ $ this ->assertEquals ('https://notion.so ' , $ blockChild ->getUrl ());
159168 }
160169
161170 /** @test */
@@ -202,6 +211,7 @@ public function it_returns_parent_block_in_which_new_blocks_have_been_successful
202211 $ numberedListItem = NumberedListItem::create ("New TextBlock " );
203212 $ toDo = ToDo::create ("New TextBlock " );
204213 $ toggle = Toggle::create (["New TextBlock " ]);
214+ $ embed = Embed::create ("https://5amco.de " , "Testcaption " );
205215
206216 $ parentBlock = Notion::block ('1d719dd1-563b-4387-b74f-20da92b827fb ' )->append ($ paragraph );
207217 $ this ->assertInstanceOf (Block::class, $ parentBlock );
@@ -227,8 +237,11 @@ public function it_returns_parent_block_in_which_new_blocks_have_been_successful
227237 $ parentBlock = Notion::block ('1d719dd1-563b-4387-b74f-20da92b827fb ' )->append ($ toggle );
228238 $ this ->assertInstanceOf (Block::class, $ parentBlock );
229239
240+ $ parentBlock = Notion::block ('1d719dd1-563b-4387-b74f-20da92b827fb ' )->append ($ embed );
241+ $ this ->assertInstanceOf (Block::class, $ parentBlock );
242+
230243
231- $ parentBlock = Notion::block ('1d719dd1-563b-4387-b74f-20da92b827fb ' )->append ([$ paragraph , $ bulletedListItem , $ headingOne , $ headingTwo , $ headingThree , $ numberedListItem , $ toDo , $ toggle ]);
244+ $ parentBlock = Notion::block ('1d719dd1-563b-4387-b74f-20da92b827fb ' )->append ([$ paragraph , $ bulletedListItem , $ headingOne , $ headingTwo , $ headingThree , $ numberedListItem , $ toDo , $ toggle, $ embed ]);
232245 $ this ->assertInstanceOf (Block::class, $ parentBlock );
233246 }
234247}
0 commit comments