]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/PagesApiTest.php
Added markdown export endpoints to API
[bookstack] / tests / Api / PagesApiTest.php
index e08e9b1b742b1424f4b6dba465ea994395d80908..9fab675e739644b11df8284a0355c6456627e6fb 100644 (file)
@@ -258,4 +258,15 @@ class PagesApiTest extends TestCase
         $resp->assertStatus(200);
         $resp->assertHeader('Content-Disposition', 'attachment; filename="' . $page->slug . '.pdf"');
     }
+
+    public function test_export_markdown_endpoint()
+    {
+        $this->actingAsApiEditor();
+        $page = Page::visible()->first();
+
+        $resp = $this->get($this->baseEndpoint . "/{$page->id}/export/markdown");
+        $resp->assertStatus(200);
+        $resp->assertSee('# ' . $page->name);
+        $resp->assertHeader('Content-Disposition', 'attachment; filename="' . $page->slug . '.md"');
+    }
 }
\ No newline at end of file