1
0
Fork 0
mirror of https://github.com/archtechx/laravel-seo.git synced 2025-12-12 01:44:03 +00:00

fix tests broken by #39

This commit is contained in:
Samuel Štancl 2024-11-23 00:45:49 +01:00
parent f4ec8c0fab
commit c768bb7d60
7 changed files with 26 additions and 26 deletions

View file

@ -40,7 +40,7 @@ test('extensions can use custom blade paths', function () {
seo()->facebookTitle('abc');
expect(meta())->toContain('<meta name="facebook:title" content="ABC" />');
expect(meta())->toContain('<meta name="facebook:title" content="ABC">');
});
test('twitter falls back to the default values', function () {
@ -56,7 +56,7 @@ test('twitter falls back to the default values', function () {
expect(seo('twitter.description'))->toBe('bar');
expect(seo('description'))->toBe('baz');
expect(meta())->toContain('<meta name="twitter:title" content="foo" />');
expect(meta())->toContain('<meta name="twitter:title" content="foo">');
});
test('extensions are automatically enabled when values for them are set', function () {

View file

@ -86,7 +86,7 @@ test('setting the defaults returns the manager instance', function () {
test('meta tags can be added to the template', function () {
seo()->tag('fb:image', 'foo');
expect(meta())->toContain('<meta property="fb:image" content="foo" />');
expect(meta())->toContain('<meta property="fb:image" content="foo">');
});
test('raw tags can be added to the template', function () {
@ -114,8 +114,8 @@ test('canonical url can be read from request', function () {
seo()->withUrl();
expect(meta())
->toContain('<meta property="og:url" content="http://localhost" />')
->toContain('<link rel="canonical" href="http://localhost" />');
->toContain('<meta property="og:url" content="http://localhost">')
->toContain('<link rel="canonical" href="http://localhost">');
});
test('canonical url can be changed', function () {
@ -124,8 +124,8 @@ test('canonical url can be changed', function () {
seo()->url('http://foo.com/bar');
expect(meta())
->toContain('<meta property="og:url" content="http://foo.com/bar" />')
->toContain('<link rel="canonical" href="http://foo.com/bar" />');
->toContain('<meta property="og:url" content="http://foo.com/bar">')
->toContain('<link rel="canonical" href="http://foo.com/bar">');
});
test('og:title can be overridden using a tag', function () {
@ -134,16 +134,16 @@ test('og:title can be overridden using a tag', function () {
expect(meta())
->toContain('<title>foo</title>')
->toContain('<meta property="og:title" content="bar" />');
->toContain('<meta property="og:title" content="bar">');
});
test('type can be overridden using the type method', function () {
expect(meta())->toContain('<meta property="og:type" content="website" />'); // default
expect(meta())->toContain('<meta property="og:type" content="website">'); // default
seo()->type('foo');
expect(meta())
->toContain('<meta property="og:type" content="foo" />') // overridden
->toContain('<meta property="og:type" content="foo">') // overridden
->not()->toContain('website');
});
@ -155,5 +155,5 @@ test('og:locale is not included by default', function () {
test('og:locale can be added to the template', function () {
seo()->locale('de_DE');
expect(meta())->toContain('<meta property="og:locale" content="de_DE" />');
expect(meta())->toContain('<meta property="og:locale" content="de_DE">');
});

View file

@ -13,8 +13,8 @@ test('opengraph methods properly sanitize input', function (string $method, stri
expect($meta)->not()->toContain('content="Testing string " with several \' XSS characters </title> " . \' ."');
expect($meta)->not()->toContain("content=\"{$unsanitizedContent}\"");
expect($meta)->toContain("<meta property=\"$property\" content=\"{$sanitizedContent}\" />");
expect($meta)->toContain("<meta property=\"$property\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\" />");
expect($meta)->toContain("<meta property=\"$property\" content=\"{$sanitizedContent}\">");
expect($meta)->toContain("<meta property=\"$property\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\">");
})->with([
['site', 'og:site_name'],
['url', 'og:url'],
@ -37,8 +37,8 @@ test('the twitter extension properly sanitizes input', function (string $method,
expect($meta)->not()->toContain('content="Testing string " with several \' XSS characters </title> " . \' ."');
expect($meta)->not()->toContain("content=\"{$unsanitizedContent}\"");
expect($meta)->toContain("<meta name=\"$property\" content=\"{$sanitizedContent}\" />");
expect($meta)->toContain("<meta name=\"$property\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\" />");
expect($meta)->toContain("<meta name=\"$property\" content=\"{$sanitizedContent}\">");
expect($meta)->toContain("<meta name=\"$property\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\">");
})->with([
['twitterCreator', 'twitter:creator'],
['twitterSite', 'twitter:site'],
@ -65,8 +65,8 @@ test('the title method properly sanitizes both tags', function () {
expect($meta)->toContain("<title>{$sanitizedContent}</title>");
expect($meta)->toContain("<title>Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .</title>");
expect($meta)->toContain("<meta property=\"og:title\" content=\"{$sanitizedContent}\" />");
expect($meta)->toContain("<meta property=\"og:title\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\" />");
expect($meta)->toContain("<meta property=\"og:title\" content=\"{$sanitizedContent}\">");
expect($meta)->toContain("<meta property=\"og:title\" content=\"Testing string &quot; with several &#039; XSS characters &lt;/title&gt; &quot; . &#039; .\">");
});
test('seo blade directive calls are sanitized', function () {

View file

@ -1 +1 @@
<meta name="facebook:title" content="{{ strtoupper(seo()->facebookTitle) }}" />
<meta name="facebook:title" content="{{ strtoupper(seo()->facebookTitle) }}">