fix: notification comment tag tests

Tagging a user while creating a comment will both create a notification for the tag, as well as create a notification to the user who made the torrent/request. We only want to assert that the count of notifications created during the test is 1 only for the tag notifications and not count the other notification created.
This commit is contained in:
Roardom
2025-03-09 06:16:51 +00:00
parent f8060e3e22
commit 7e4ae4a5fc
3 changed files with 27 additions and 30 deletions
@@ -75,10 +75,10 @@ test('user tags user on request creates a notification for tagged user', functio
$this->assertEquals(1, Comment::count());
Notification::assertSentTo(
[$user],
NewCommentTag::class
$user,
NewCommentTag::class,
1,
);
Notification::assertCount(1);
});
test('user tags user on request creates a notification for tagged user when mentions are disabled for other specific group', function (): void {
@@ -128,11 +128,11 @@ test('user tags user on request creates a notification for tagged user when ment
$this->assertEquals(1, Comment::count());
Notification::assertSentTo(
[$user],
NewCommentTag::class
Notification::assertSentToTimes(
$user,
NewCommentTag::class,
1,
);
Notification::assertCount(1);
});
test('user tags user on request does not create a notification for tagged user when all notifications disabled', function (): void {
@@ -74,11 +74,11 @@ test('user tags user on torrent creates a notification for tagged user', functio
$this->assertEquals(1, Comment::count());
Notification::assertSentTo(
[$user],
NewCommentTag::class
Notification::assertSentToTimes(
$user,
NewCommentTag::class,
1,
);
Notification::assertCount(1);
});
test('user tags user on torrent creates a notification for tagged user when mentions are disabled for other specific group', function (): void {
@@ -128,11 +128,11 @@ test('user tags user on torrent creates a notification for tagged user when ment
$this->assertEquals(1, Comment::count());
Notification::assertSentTo(
[$user],
NewCommentTag::class
Notification::assertSentToTimes(
$user,
NewCommentTag::class,
1,
);
Notification::assertCount(1);
});
test('user tags user on torrent does not create a notification for tagged user when all notifications disabled', function (): void {
@@ -93,11 +93,11 @@ test('user tags user in forum topic creates a notification for tagged user', fun
'user_id' => $poster->id,
]);
Notification::assertSentTo(
[$user],
NewPostTag::class
Notification::assertSentToTimes(
$user,
NewPostTag::class,
1,
);
Notification::assertCount(1);
});
test('user tags user in forum topic creates a notification for tagged user when post mention notifications are not disabled for specific group', function (): void {
@@ -166,11 +166,11 @@ test('user tags user in forum topic creates a notification for tagged user when
'user_id' => $poster->id,
]);
Notification::assertSentTo(
[$user],
NewPostTag::class
Notification::assertSentToTimes(
$user,
NewPostTag::class,
1,
);
Notification::assertCount(1);
});
test('user tags user in forum topic does not create a notification for tagged user when all notifications disabled', function (): void {
@@ -241,7 +241,6 @@ test('user tags user in forum topic does not create a notification for tagged us
[$user],
NewPostTag::class
);
Notification::assertCount(0);
});
test('staff tags user in forum topic creates a notification for tagged user even when post mention notifications are disabled', function (): void {
@@ -309,11 +308,11 @@ test('staff tags user in forum topic creates a notification for tagged user even
'user_id' => $poster->id,
]);
Notification::assertSentTo(
[$user],
NewPostTag::class
Notification::assertSentToTimes(
$user,
NewPostTag::class,
1,
);
Notification::assertCount(1);
});
test('user tags user in forum topic does not create a notification for tagged user when post mention notifications are disabled', function (): void {
@@ -384,7 +383,6 @@ test('user tags user in forum topic does not create a notification for tagged us
[$user],
NewPostTag::class
);
Notification::assertCount(0);
});
test('user tags user in forum topic does not create a notification for tagged user when post mention notifications are not disabled for specific group', function (): void {
@@ -456,5 +454,4 @@ test('user tags user in forum topic does not create a notification for tagged us
[$user],
NewPostTag::class
);
Notification::assertCount(0);
});