Skip to content

Commit 155e573

Browse files
committed
added bad response test for database query
1 parent 0511acf commit 155e573

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/EndpointDatabaseTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,23 @@ public function it_queries_a_database_with_filter_and_sorting_and_processes_resu
104104
$this->assertEquals("Betty Holberton", $page->getTitle());
105105
}
106106

107+
/** @test */
108+
public function it_throws_a_notion_exception_bad_request()
109+
{
110+
// failing /v1/databases
111+
Http::fake([
112+
'https://api.notion.com/v1/databases/8284f3ff77e24d4a939d19459e4d6bdc/query*'
113+
=> Http::response(
114+
json_decode('{}', true),
115+
400,
116+
['Headers']
117+
)
118+
]);
119+
120+
$this->expectException(NotionException::class);
121+
$this->expectExceptionMessage("Bad Request");
122+
123+
\Notion::database("8284f3ff77e24d4a939d19459e4d6bdc")->query();
124+
}
125+
107126
}

0 commit comments

Comments
 (0)