Skip to content

Commit

Permalink
Added simple SpamDetectorTest
Browse files Browse the repository at this point in the history
  • Loading branch information
tabuna committed Mar 20, 2024
1 parent 801d769 commit 2e21790
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/Unit/SpamDetectorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Tests\Unit;

use App\Services\SpamDetector;
use Tests\TestCase;

class SpamDetectorTest extends TestCase
{
/**
* Test if the message is classified as spam.
*
* @dataProvider messageProvider
*/
public function testIsSpam($message, $expected)
{
$spamDetector = new SpamDetector($message);
$this->assertEquals($expected, $spamDetector->isSpam());
}

/**
* Data provider for messages and expected results.
*/
public static function messageProvider()
{
return [
['А вот интересно кстати, какова вообще вероятность кражи токена?', false],
['Нужны партнеры в сферу (крипта) заработка. Пассивный доход от 10% в месяц. Подробности в ЛС', true],
['Стабильный доход от 100$ Нужен только телефон', true],
['блокчейн в ЛС', true],
['Крипто инвестиции', true],
];
}
}

0 comments on commit 2e21790

Please sign in to comment.