This commit is contained in:
Pig Fang 2020-02-16 10:03:47 +08:00
parent d811f92dda
commit 5ac9b59116

View File

@ -4,7 +4,6 @@ namespace Tests;
use App\Models\User; use App\Models\User;
use App\Services\Hook; use App\Services\Hook;
use Symfony\Component\DomCrawler\Crawler;
class HookTest extends TestCase class HookTest extends TestCase
{ {
@ -90,12 +89,8 @@ class HookTest extends TestCase
{ {
$user = factory(User::class)->create(); $user = factory(User::class)->create();
Hook::sendNotification([$user], 'Ibara Mayaka'); Hook::sendNotification([$user], 'Ibara Mayaka');
$html = $this->actingAs($user) $user->refresh();
->get('/user') $this->assertCount(1, $user->unreadNotifications);
->assertSee('Ibara Mayaka')
->getContent();
$crawler = new Crawler($html);
$this->assertEquals('1', trim($crawler->filter('.badge-warning')->text()));
} }
public function testPushMiddleware() public function testPushMiddleware()