mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-27 07:31:40 +01:00
Added unit tests for helpers and tests for commands
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Helpers\NotificationsHelper;
|
||||
|
||||
use App\Helpers\NotificationsHelper;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ThresholdMessageTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test absolute message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAbsoluteMessageMultiField()
|
||||
{
|
||||
$msg = NotificationsHelper::formatAbsoluteThresholdMessage([ 'ping', 'upload' ]);
|
||||
|
||||
$this->assertEquals('For the latest speedtest, the ping, upload values exceeded the absolute threshold', $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test absolute message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testAbsoluteMessageSingleField()
|
||||
{
|
||||
$msg = NotificationsHelper::formatAbsoluteThresholdMessage([ 'ping' ]);
|
||||
|
||||
$this->assertEquals('For the latest speedtest, the ping value exceeded the absolute threshold', $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test absolute message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPercentageMessageMultiField()
|
||||
{
|
||||
$msg = NotificationsHelper::formatPercentageThresholdMessage([ 'ping', 'upload' ]);
|
||||
|
||||
$this->assertEquals('For the latest speedtest, the ping, upload values exceeded the percentage threshold', $msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test absolute message
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPercentageMessageSingleField()
|
||||
{
|
||||
$msg = NotificationsHelper::formatPercentageThresholdMessage([ 'ping' ]);
|
||||
|
||||
$this->assertEquals('For the latest speedtest, the ping value exceeded the percentage threshold', $msg);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user