32 lines
833 B
PHP
32 lines
833 B
PHP
|
<?php
|
||
|
|
||
|
namespace Tests\Feature;
|
||
|
|
||
|
use Tests\TestCase;
|
||
|
use Tests\TestToken;
|
||
|
use App\Jobs\ProcessBookmark;
|
||
|
use Illuminate\Support\Facades\Queue;
|
||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||
|
|
||
|
class BookmarksTest extends TestCase
|
||
|
{
|
||
|
use DatabaseTransactions, TestToken;
|
||
|
|
||
|
public function test_browsershot_job_dispatches_when_bookmark_added()
|
||
|
{
|
||
|
Queue::fake();
|
||
|
|
||
|
$response = $this->withHeaders([
|
||
|
'Authorization' => 'Bearer ' . $this->getToken(),
|
||
|
])->post('/api/post', [
|
||
|
'h' => 'entry',
|
||
|
'bookmark-of' => 'https://example.org/blog-post',
|
||
|
]);
|
||
|
|
||
|
$response->assertJson(['response' => 'created']);
|
||
|
|
||
|
Queue::assertPushed(ProcessBookmark::class);
|
||
|
$this->assertDatabaseHas('bookmarks', ['url' => 'https://example.org/blog-post']);
|
||
|
}
|
||
|
}
|