Skip to content

Commit

Permalink
Add a test for embed fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshPiper committed Mar 12, 2020
1 parent 62fcf0b commit 210a1d7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/QueuedWebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
declare(strict_types=1);

use PHPUnit\Framework\TestCase;
use Internet\InterCord\RichEmbed;
use Internet\InterCord\QueuedWebhook;
use Internet\InterCord\Internal\Payload;
use GuzzleHttp\Exception\ClientException;
Expand All @@ -18,7 +19,7 @@ public function tearDown(): void{
}

public function payloads(){
$contents = ['content', '1234', 4321, ['array with one arg', (new \Internet\InterCord\RichEmbed())->addField("hi", "yes")]];
$contents = ['content', '1234', 4321, ['array with one arg', (new RichEmbed())->addField("hi", "yes")]];
$usernames = ['', 'testUser'];
$avatars = ['', 'https://images.theconversation.com/files/93616/original/image-20150902-6700-t2axrz.jpg?ixlib=rb-1.1.0&q=45&auto=format&w=1000&fit=clip'];

Expand Down Expand Up @@ -56,6 +57,14 @@ public function testDelivery($content, $username, $avatar){
$this->assertEquals($this->webhook->count(), 0, "empty");
}

public function test(){
$embed = new RichEmbed();
$embed->addField("CI?", "yes", true);

$this->webhook->deliver($embed);
$this->assertEquals($this->webhook->count(), 0, "empty");
}

public function testEmptyMessageException(){
$this->expectException(ClientException::class);
$this->webhook->prepend('');
Expand Down

0 comments on commit 210a1d7

Please sign in to comment.