From 2d8678b03757acff3b2ac61c7494c5d754404b5b Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 19 May 2017 13:16:30 +0100 Subject: [PATCH] Add some tests for syndication jobs --- tests/Feature/NoteServiceTest.php | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/Feature/NoteServiceTest.php diff --git a/tests/Feature/NoteServiceTest.php b/tests/Feature/NoteServiceTest.php new file mode 100644 index 00000000..a7b44db1 --- /dev/null +++ b/tests/Feature/NoteServiceTest.php @@ -0,0 +1,60 @@ +createNote([ + 'content' => 'Hello Fred', + 'in-reply-to' => 'https://fredbloggs.com/note/abc', + 'syndicate' => ['twitter'], + ]); + + Queue::assertPushed(SyndicateToTwitter::class); + } + + public function test_syndicate_to_facebook_job_is_sent() + { + Queue::fake(); + + $noteService = new NoteService(); + $note = $noteService->createNote([ + 'content' => 'Hello Fred', + 'in-reply-to' => 'https://fredbloggs.com/note/abc', + 'syndicate' => ['facebook'], + ]); + + Queue::assertPushed(SyndicateToFacebook::class); + } + + public function test_syndicate_to_target_jobs_are_sent() + { + Queue::fake(); + + $noteService = new NoteService(); + $note = $noteService->createNote([ + 'content' => 'Hello Fred', + 'in-reply-to' => 'https://fredbloggs.com/note/abc', + 'syndicate' => ['twitter', 'facebook'], + ]); + + Queue::assertPushed(SyndicateToTwitter::class); + Queue::assertPushed(SyndicateToFacebook::class); + } +}