Skip to content

Commit

Permalink
Merge pull request #3 from ossycodes/fix-tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
ossycodes authored Jan 7, 2023
2 parents 0e0e9b7 + 723ecbb commit 79c3ef3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/FriendlyCaptchaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function setUp(): void
{
parent::setUp();

$this->captcha = new FriendlyCaptcha('{secret-key}', '{site-key}');
$this->captcha = new FriendlyCaptcha('{secret-key}', '{site-key}', 'https://api.friendlycaptcha.com/api/v1/puzzle', 'https://api.friendlycaptcha.com/api/v1/siteverify');
}

/**
Expand All @@ -32,8 +32,8 @@ public function it_can_render_unpkg_widget_script_correctly()
{
$this->assertTrue($this->captcha instanceof FriendlyCaptcha);

$expectedScriptOne = '<script type="module" src="https://unpkg.com/[email protected].8/widget.module.min.js" async defer></script>';
$expectedScriptTwo = '<script nomodule src="https://unpkg.com/[email protected].8/widget.min.js" async defer></script>';
$expectedScriptOne = '<script type="module" src="https://unpkg.com/[email protected].9/widget.module.min.js" async defer></script>';
$expectedScriptTwo = '<script nomodule src="https://unpkg.com/[email protected].9/widget.min.js" async defer></script>';

$this->assertStringContainsString($expectedScriptOne, $this->captcha->renderWidgetScripts());
$this->assertStringContainsString($expectedScriptTwo, $this->captcha->renderWidgetScripts());
Expand All @@ -46,8 +46,8 @@ public function it_can_render_jsdelivr_widget_script_correctly()
{
$this->assertTrue($this->captcha instanceof FriendlyCaptcha);

$expectedScriptOne = '<script type="module" src="https://cdn.jsdelivr.net/npm/[email protected].8/widget.module.min.js" async defer></script>';
$expectedScriptTwo = '<script nomodule src="https://cdn.jsdelivr.net/npm/[email protected].8/widget.min.js" async defer></script>';
$expectedScriptOne = '<script type="module" src="https://cdn.jsdelivr.net/npm/[email protected].9/widget.module.min.js" async defer></script>';
$expectedScriptTwo = '<script nomodule src="https://cdn.jsdelivr.net/npm/[email protected].9/widget.min.js" async defer></script>';

$this->assertStringContainsString($expectedScriptOne, $this->captcha->renderWidgetScripts('jsdelivr'));
$this->assertStringContainsString($expectedScriptTwo, $this->captcha->renderWidgetScripts('jsdelivr'));
Expand All @@ -60,8 +60,8 @@ public function it_can_render_widget_correctly()
{
$this->assertTrue($this->captcha instanceof FriendlyCaptcha);

$expectedWidget = '<div data-sitekey="{site-key}" class="frc-captcha"></div>';
$expectedWidgetWithCustomAttributes = '<div data-sitekey="{site-key}" class="frc-captcha dark"></div>';
$expectedWidget = '<div data-puzzle-endpoint="https://api.friendlycaptcha.com/api/v1/puzzle" data-sitekey="{site-key}" class="frc-captcha" data-lang="en"></div>';
$expectedWidgetWithCustomAttributes = '<div data-puzzle-endpoint="https://api.friendlycaptcha.com/api/v1/puzzle" data-sitekey="{site-key}" class="frc-captcha dark"></div>';

$this->assertEquals($expectedWidget, $this->captcha->renderWidget());
$this->assertEquals($expectedWidgetWithCustomAttributes, $this->captcha->renderWidget(['dark-theme' => true]));
Expand Down

0 comments on commit 79c3ef3

Please sign in to comment.