Add jf2 feeds for notes and blog posts

This commit is contained in:
Jonny Barnes 2020-06-20 16:47:39 +01:00
parent 112c6e02d5
commit 0195814219
3 changed files with 125 additions and 4 deletions

View file

@ -39,6 +39,27 @@ class FeedsTest extends TestCase
$response->assertHeader('Content-Type', 'application/atom+xml; charset=utf-8');
}
/** @test */
public function blog_jf2_feed()
{
$response = $this->get('/blog/feed.jf2');
$response->assertHeader('Content-Type', 'application/jf2feed+json');
$response->assertJson([
'type' => 'feed',
'name' => 'Blog feed for ' . config('app.name'),
'url' => url('/blog'),
'author' => [
'type' => 'card',
'name' => config('user.displayname'),
'url' => config('app.longurl'),
],
'children' => [[
'type' => 'entry',
'post-type' => 'article',
]]
]);
}
/**
* Test the notes RSS feed.
*
@ -72,6 +93,27 @@ class FeedsTest extends TestCase
$response->assertHeader('Content-Type', 'application/json');
}
/** @test */
public function notes_jf2_feed()
{
$response = $this->get('/notes/feed.jf2');
$response->assertHeader('Content-Type', 'application/jf2feed+json');
$response->assertJson([
'type' => 'feed',
'name' => 'Notes feed for ' . config('app.name'),
'url' => url('/notes'),
'author' => [
'type' => 'card',
'name' => config('user.displayname'),
'url' => config('app.longurl'),
],
'children' => [[
'type' => 'entry',
'post-type' => 'note',
]]
]);
}
/**
* Each JSON feed item must have one of `content_text` or `content_html`,
* and whichever one they have cant be `null`.