2727 ->storeIn ('snapshots/databases ' );
2828});
2929
30+ it ('should throw a handling exception if no title property is added ' , function (){
31+ $ this ->httpRecorder ->nameForNextRequest ('400-no-title-property ' );
32+ $ this ->expectException (\FiveamCode \LaravelNotionApi \Exceptions \NotionException::class);
33+ $ this ->expectExceptionMessage ('Bad Request: (validation_error) (Title is not provided) ' );
34+ $ this ->expectExceptionCode (400 );
35+
36+ \Notion::databases ()
37+ ->build ()
38+ ->add (PropertyBuilder::checkbox ('Test Checkbox ' ))
39+ ->createInPage ('0adbc2eb57e84569a700a70d537615be ' );
40+ });
41+
3042it ('should create a new database with all available properties ' , function () {
3143 $ this ->httpRecorder ->nameForNextRequest ('all-properties ' );
3244
7486 ->description ('This Database has been created by a Pest Test from Laravel ' )
7587 ->add ($ scheme )
7688 ->createInPage ('0adbc2eb57e84569a700a70d537615be ' );
89+
90+ expect ($ databaseEntity ->getCover ())->toEqual ('https://example.com/cover.jpg ' );
91+ expect ($ databaseEntity ->getIcon ())->toEqual ('https://example.com/cover.jpg ' );
92+ //TODO: Currently not supported due to Notion API versioning
93+ // expect($databaseEntity->getDescription())->toEqual('This Database has been created by a Pest Test from Laravel');
94+ expect ($ databaseEntity ->getTitle ())->toEqual ('Created By Testing Database ' );
95+ expect ($ databaseEntity ->getParentId ())->toEqual ('0adbc2eb-57e8-4569-a700-a70d537615be ' );
7796
7897 expect ($ databaseEntity ->getProperties ())->toHaveCount (18 );
7998 expect ($ databaseEntity ->getProperty ('Test Title ' ))->toBeInstanceOf (Title::class);
104123 expect ($ databaseEntity ->getProperty ('Test MultiSelect ' )->getOptions ()[0 ]->getColor ())->toEqual ($ multiSelectOptions [0 ]['color ' ]);
105124
106125 expect ($ databaseEntity ->getProperty ('Test Number ' )->getRawResponse ()['number ' ]['format ' ])->toBe ('dollar ' );
107- });
126+ });
0 commit comments