From 29ef9c12d103d104a3dd0a85a4b405158c070fa7 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 26 Feb 2017 14:43:52 +0000 Subject: [PATCH] Add test for note creation --- tests/Browser/MicropubClientTest.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/Browser/MicropubClientTest.php b/tests/Browser/MicropubClientTest.php index 5ca3a5a5..25cece44 100644 --- a/tests/Browser/MicropubClientTest.php +++ b/tests/Browser/MicropubClientTest.php @@ -15,11 +15,25 @@ class MicropubClientTest extends DuskTestCase public function test_client_page_see_authenticated() { $this->browse(function ($browser) { - $browser->visit('/micropub/create') + $browser->visit(route('micropub-client')) ->assertSee('You are authenticated'); }); } + public function test_client_page_creates_new_note() + { + $faker = \Faker\Factory::create(); + $note = 'Fake note from #LaravelDusk: ' . $faker->text; + $this->browse(function ($browser) use ($note) { + $browser->visit(route('micropub-client')) + ->type('content', $note) + ->press('Submit'); + }); + $this->assertDatabaseHas('notes', ['note' => $note]); + $newNote = \App\Note::where('note', $note)->first(); + $newNote->forceDelete(); + } + public function test_client_page_updates_syndication() { $this->browse(function ($browser) {