1
0

instance_serializer_spec.rb 856 B

12345678910111213141516171819202122232425262728293031
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe REST::InstanceSerializer do
  4. let(:serialization) { serialized_record_json(record, described_class) }
  5. let(:record) { InstancePresenter.new }
  6. describe 'usage' do
  7. it 'returns recent usage data' do
  8. expect(serialization['usage']).to eq({ 'users' => { 'active_month' => 0 } })
  9. end
  10. end
  11. describe 'configuration' do
  12. it 'returns the VAPID public key' do
  13. expect(serialization['configuration']['vapid']).to eq({
  14. 'public_key' => Rails.configuration.x.vapid_public_key,
  15. })
  16. end
  17. it 'returns the max pinned statuses limit' do
  18. expect(serialization.deep_symbolize_keys)
  19. .to include(
  20. configuration: include(
  21. accounts: include(max_pinned_statuses: StatusPinValidator::PIN_LIMIT)
  22. )
  23. )
  24. end
  25. end
  26. end