Merge commit 'aff51823752b809c3349698b6be02bfdda7a9010' into glitch-soc/merge-upstream

This commit is contained in:
Claire
2025-03-12 19:48:51 +01:00
45 changed files with 1437 additions and 287 deletions

View File

@@ -16,6 +16,7 @@ RSpec.describe 'API V1 Push Subscriptions' do
subscription: {
endpoint: endpoint,
keys: keys,
standard: standard,
},
}.with_indifferent_access
end
@@ -36,6 +37,7 @@ RSpec.describe 'API V1 Push Subscriptions' do
},
}.with_indifferent_access
end
let(:standard) { '1' }
let(:scopes) { 'push' }
let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: scopes) }
let(:headers) { { 'Authorization' => "Bearer #{token.token}" } }
@@ -66,6 +68,7 @@ RSpec.describe 'API V1 Push Subscriptions' do
user_id: eq(user.id),
access_token_id: eq(token.id)
)
.and be_standard
expect(response.parsed_body.with_indifferent_access)
.to include(
@@ -73,6 +76,17 @@ RSpec.describe 'API V1 Push Subscriptions' do
)
end
context 'when standard is provided as false value' do
let(:standard) { '0' }
it 'saves push subscription with standard as false' do
subject
expect(endpoint_push_subscription)
.to_not be_standard
end
end
it 'replaces old subscription on repeat calls' do
2.times { subject }