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

Make flipp use raw values

This commit is contained in:
Samuel Štancl 2021-05-24 19:24:22 +02:00
parent 9cebfec4c8
commit ab1e01b066
3 changed files with 33 additions and 3 deletions

View file

@ -27,7 +27,7 @@ test('the flipp method returns a link to a signed url', function () {
seo()->flipp('blog', 'abcdefg');
expect(seo()->flipp('blog', ['title' => 'abc']))
->toContain('?s=' . hash_hmac('sha256', 'blog' . base64_encode(json_encode(['title' => 'abc'])), config('services.flipp.key')));
->toContain('?s=' . hash_hmac('sha256', 'abcdefg' . base64_encode(json_encode(['title' => 'abc'])), config('services.flipp.key')));
});
test("flipp templates use default data when they're not passed any data explicitly", function () {
@ -57,3 +57,14 @@ test('the blade directive can be used with flipp', function () {
expect(blade("@seo('flipp', 'blog')"))->toBe(seo()->flipp('blog'));
expect(blade("@seo('flipp', 'blog', ['title' => 'abc'])"))->toBe(seo()->flipp('blog', ['title' => 'abc']));
});
test('flipp uses the raw title and description', function () {
seo()->flipp('blog', 'abcdefg');
seo()->title(modify: fn (string $title) => $title . ' - modified');
seo()->title('foo')->description('bar');
expect(seo()->flipp('blog'))
->toContain('s.useflipp.com/abcdefg')
->toContain(base64_encode(json_encode(['title' => 'foo', 'description' => 'bar'])));
});

View file

@ -19,3 +19,12 @@ test('modifiers are not applied on default values', function () {
expect(seo('title'))->toBe('ArchTech — Web development agency');
});
test('modifiers can be bypassed by using the raw method', function () {
seo()->title(modify: fn (string $title) => $title . ' | ArchTech');
seo()->title('About us');
expect(seo()->get('title'))->toBe('About us | ArchTech');
expect(seo()->raw('title'))->toBe('About us');
});