Merge remote-tracking branch 'parent/main' into upstream-20241126

This commit is contained in:
KMY 2024-11-26 12:56:31 +09:00
commit 8a075ba4c6
303 changed files with 7495 additions and 4498 deletions

View file

@ -21,18 +21,27 @@ RSpec.describe AnnualReport::CommonlyInteractedWithAccounts do
let(:account) { Fabricate :account }
let(:other_account) { Fabricate :account }
let(:most_other_account) { Fabricate :account }
before do
_other = Fabricate :status
Fabricate :status, account: account, reply: true, in_reply_to_id: Fabricate(:status, account: other_account).id
Fabricate :status, account: account, reply: true, in_reply_to_id: Fabricate(:status, account: other_account).id
Fabricate :status, account: account, reply: true, in_reply_to_id: Fabricate(:status, account: most_other_account).id
Fabricate :status, account: account, reply: true, in_reply_to_id: Fabricate(:status, account: most_other_account).id
Fabricate :status, account: account, reply: true, in_reply_to_id: Fabricate(:status, account: most_other_account).id
end
it 'builds a report for an account' do
expect(subject.generate)
.to include(
commonly_interacted_with_accounts: contain_exactly(
include(account_id: other_account.id.to_s, count: 2)
commonly_interacted_with_accounts: eq(
[
{ account_id: most_other_account.id.to_s, count: 3 },
{ account_id: other_account.id.to_s, count: 2 },
]
)
)
end

View file

@ -21,18 +21,26 @@ RSpec.describe AnnualReport::MostRebloggedAccounts do
let(:account) { Fabricate :account }
let(:other_account) { Fabricate :account }
let(:most_other_account) { Fabricate :account }
before do
_other = Fabricate :status
Fabricate :status, account: account, reblog: Fabricate(:status, account: other_account)
Fabricate :status, account: account, reblog: Fabricate(:status, account: other_account)
Fabricate :status, account: account, reblog: Fabricate(:status, account: most_other_account)
Fabricate :status, account: account, reblog: Fabricate(:status, account: most_other_account)
Fabricate :status, account: account, reblog: Fabricate(:status, account: most_other_account)
end
it 'builds a report for an account' do
expect(subject.generate)
.to include(
most_reblogged_accounts: contain_exactly(
include(account_id: other_account.id.to_s, count: 2)
most_reblogged_accounts: eq(
[
{ account_id: most_other_account.id.to_s, count: 3 },
{ account_id: other_account.id.to_s, count: 2 },
]
)
)
end

View file

@ -20,18 +20,23 @@ RSpec.describe AnnualReport::MostUsedApps do
context 'with an active account' do
let(:account) { Fabricate :account }
let(:application) { Fabricate :application }
let(:application) { Fabricate :application, name: 'App' }
let(:most_application) { Fabricate :application, name: 'Most App' }
before do
_other = Fabricate :status
Fabricate.times 2, :status, account: account, application: application
Fabricate.times 3, :status, account: account, application: most_application
end
it 'builds a report for an account' do
expect(subject.generate)
.to include(
most_used_apps: contain_exactly(
include(name: application.name, count: 2)
most_used_apps: eq(
[
{ name: most_application.name, count: 3 },
{ name: application.name, count: 2 },
]
)
)
end

View file

@ -21,20 +21,31 @@ RSpec.describe AnnualReport::TopHashtags do
let(:account) { Fabricate :account }
let(:tag) { Fabricate :tag }
let(:most_tag) { Fabricate :tag }
before do
_other = Fabricate :status
first = Fabricate :status, account: account
first.tags << tag
first.tags << most_tag
last = Fabricate :status, account: account
last.tags << tag
last.tags << most_tag
middle = Fabricate :status, account: account
middle.tags << most_tag
end
it 'builds a report for an account' do
expect(subject.generate)
.to include(
top_hashtags: contain_exactly(
include(name: tag.name, count: 2)
top_hashtags: eq(
[
{ name: most_tag.name, count: 3 },
{ name: tag.name, count: 2 },
]
)
)
end

View file

@ -49,7 +49,8 @@ RSpec.describe LinkDetailsExtractor do
<html lang="en">
<head>
<title>Man bites dog</title>
<meta name="description" content="A dog&#39;s tale">
<meta name="descripTION" content="A dog&#39;s tale">
<link rel="pretty IcoN" href="/favicon.ico">
</head>
</html>
HTML
@ -59,7 +60,8 @@ RSpec.describe LinkDetailsExtractor do
.to have_attributes(
title: eq('Man bites dog'),
description: eq("A dog's tale"),
language: eq('en')
language: eq('en'),
icon: eq('https://example.com/favicon.ico')
)
end
end
@ -256,7 +258,7 @@ RSpec.describe LinkDetailsExtractor do
<head>
<meta property="og:url" content="https://example.com/dog.html">
<meta property="og:title" content="Man bites dog">
<meta property="og:description" content="A dog's tale">
<meta property="OG:description" content="A dog's tale">
<meta property="article:published_time" content="2022-01-31T19:53:00+00:00">
<meta property="og:author" content="Charlie Brown">
<meta property="og:locale" content="en">