mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
added test
This commit is contained in:
parent
2e8558a93d
commit
d5af1a7fb6
2 changed files with 12 additions and 1 deletions
|
@ -63,7 +63,7 @@ module Repp
|
|||
def limit
|
||||
index_params[:limit] || 200
|
||||
end
|
||||
|
||||
|
||||
def offset
|
||||
index_params[:offset] || 0
|
||||
end
|
||||
|
|
|
@ -9,6 +9,17 @@ class ReppV1RegistrarNotificationsTest < ActionDispatch::IntegrationTest
|
|||
@auth_headers = { 'Authorization' => token }
|
||||
end
|
||||
|
||||
def test_all_unreaded_poll_messages
|
||||
notification = @user.registrar.notifications.where(read: false).order(created_at: :desc).all
|
||||
get "/repp/v1/registrar/notifications/all_notifications", headers: @auth_headers
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_response :ok
|
||||
assert_equal notification.count, json[:data].count
|
||||
assert_equal json[:data].first[:text], notification.first.text
|
||||
assert_equal json[:data].last[:text], notification.last.text
|
||||
end
|
||||
|
||||
def test_gets_latest_unread_poll_message
|
||||
notification = @user.registrar.notifications.where(read: false).order(created_at: :desc).first
|
||||
get "/repp/v1/registrar/notifications", headers: @auth_headers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue