Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Dec 20, 2023
1 parent 8459d71 commit c915a64
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/pest/Feature/BlitzVariableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,32 @@

use putyourlightson\blitz\variables\BlitzVariable;

test('Include cached tag does not contain encoded slashes in params', function() {
test('Include cached tag does not contain unencoded slashes in params', function() {
$variable = new BlitzVariable();
$tagString = (string)$variable->includeCached('test');
preg_match('/_includes\?(.*)/', $tagString, $match);

expect($tagString)
expect($match[1])
->not()
->toContain('%2F');
->toContain('/');
});

test('Fetch URI tag does not contain encoded slashes in params', function() {
test('Include cached tag does not contain path param', function() {
$variable = new BlitzVariable();
$tagString = (string)$variable->includeCached('test');
preg_match('/\?(.*)/', $tagString, $match);

expect($match[1])
->not()
->toContain(Craft::$app->getConfig()->getGeneral()->pathParam . '=');
});

test('Fetch URI tag does not contain unencoded slashes in params', function() {
$variable = new BlitzVariable();
$tagString = (string)$variable->fetchUri('test', ['action' => 'x/y/z']);
preg_match('/blitz-params="(.*?)"/', $tagString, $match);

expect($tagString)
expect($match[1])
->not()
->toContain('%2F');
->toContain('/');
});

0 comments on commit c915a64

Please sign in to comment.