mirror of
https://github.com/mastodon/mastodon.git
synced 2026-03-21 18:05:23 -05:00
Add timestamp spec for markers API response (#38206)
This commit is contained in:
parent
2f989c780a
commit
e2bf09d57d
|
|
@ -32,13 +32,7 @@ class Api::V1::MarkersController < Api::BaseController
|
|||
private
|
||||
|
||||
def serialize_map(map)
|
||||
serialized = {}
|
||||
|
||||
map.each_pair do |key, value|
|
||||
serialized[key] = ActiveModelSerializers::SerializableResource.new(value, serializer: REST::MarkerSerializer).as_json
|
||||
end
|
||||
|
||||
Oj.dump(serialized)
|
||||
map.transform_values { |value| ActiveModelSerializers::SerializableResource.new(value, serializer: REST::MarkerSerializer) }
|
||||
end
|
||||
|
||||
def resource_params
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@ RSpec.describe 'API Markers' do
|
|||
|
||||
describe 'GET /api/v1/markers' do
|
||||
before do
|
||||
Fabricate(:marker, timeline: 'home', last_read_id: 123, user: user)
|
||||
Fabricate(:marker, timeline: 'notifications', last_read_id: 456, user: user)
|
||||
travel_to DateTime.parse('2026-03-15T12:34:56.789Z'), with_usec: true do
|
||||
Fabricate(:marker, timeline: 'home', last_read_id: 123, user: user)
|
||||
Fabricate(:marker, timeline: 'notifications', last_read_id: 456, user: user)
|
||||
end
|
||||
|
||||
get '/api/v1/markers', headers: headers, params: { timeline: %w(home notifications) }
|
||||
end
|
||||
|
|
@ -23,6 +25,11 @@ RSpec.describe 'API Markers' do
|
|||
notifications: include(last_read_id: '456')
|
||||
)
|
||||
end
|
||||
|
||||
it 'uses a specific style of IS08601 timestamps' do
|
||||
expect(response.parsed_body)
|
||||
.to include(home: include(updated_at: eq('2026-03-15T12:34:56.789Z')))
|
||||
end
|
||||
end
|
||||
|
||||
describe 'POST /api/v1/markers' do
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user