|
44 | 44 | $page = Notion::pages()->find('a652fac351cc4cc79f5b17eb702793ed'); |
45 | 45 | $parentPage = Notion::resolve()->parent($page->getParent()); |
46 | 46 |
|
| 47 | + expect($page->getParent()->isPage())->toBeTrue(); |
| 48 | + |
47 | 49 | expect($parentPage)->toBeInstanceOf(\FiveamCode\LaravelNotionApi\Entities\Page::class); |
48 | 50 | expect($parentPage->getId())->toBe('5ac149b9-d8f1-4d8d-ac05-facefc16ebf7'); |
49 | 51 | expect($parentPage->getTitle())->toBe('Resolve Endpoint - Testing Suite'); |
50 | 52 | }); |
51 | 53 |
|
| 54 | +it('should return the workspace parent of a page without resolving it', function () { |
| 55 | + $page = Notion::pages()->find('91f70932ee6347b59bc243e09b4cc9b0'); |
| 56 | + $parentWorkspace = Notion::resolve()->parent($page->getParent()); |
| 57 | + |
| 58 | + expect($page->getParent()->isWorkspace())->toBeTrue(); |
| 59 | + |
| 60 | + expect($parentWorkspace)->toBeInstanceOf(NotionParent::class); |
| 61 | + expect($parentWorkspace->getId())->toBe('1'); |
| 62 | + expect($parentWorkspace->getObjectType())->toBe('workspace'); |
| 63 | +}); |
| 64 | + |
52 | 65 | it('should resolve the database parent of a page', function () { |
53 | 66 | $page = Notion::pages()->find('415d9b6c6e454f42aab2b6e13804cfe9'); |
54 | 67 |
|
| 68 | + expect($page->getParent()->isDatabase())->toBeTrue(); |
| 69 | + |
55 | 70 | $database = Notion::resolve()->parent($page->getParent()); |
56 | 71 | expect($database)->toBeInstanceOf(\FiveamCode\LaravelNotionApi\Entities\Database::class); |
57 | 72 | expect($database->getId())->toBe('8a0ef209-8c8a-4fd1-a21c-db7ab327e870'); |
|
61 | 76 | it('should resolve the block parent of a block', function () { |
62 | 77 | $block = Notion::block('d5f9419b44204c909501b1e2b7569503')->retrieve(); |
63 | 78 |
|
| 79 | + expect($block->getParent()->isBlock())->toBeTrue(); |
| 80 | + |
64 | 81 | $parentBlock = Notion::resolve()->parent($block->getParent()); |
65 | 82 | expect($parentBlock)->toBeInstanceOf(\FiveamCode\LaravelNotionApi\Entities\Blocks\Block::class); |
66 | 83 | expect($parentBlock->getId())->toBe('0971ac1a-b6f2-4acc-b706-f5f2ed16ffd6'); |
|
0 commit comments