0
0
Fork 0

Add coverage for standard params on push subs create (#34092)

This commit is contained in:
Matt Jankowski 2025-03-12 10:29:19 -04:00 committed by GitHub
parent fef446d22c
commit f71a855e2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 5 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 }