Commit 385524c3 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Add tests

parent 4f53ab13
......@@ -121,6 +121,22 @@ describe 'Dropdown emoji', :js do
send_keys_to_filtered_search(':')
end
it 'selects `None`' do
find('#js-dropdown-assignee .filter-dropdown-item', text: 'None').click
expect(page).to have_css(js_dropdown_emoji, visible: false)
expect_tokens([emoji_token('none')])
expect_filtered_search_input_empty
end
it 'selects `Any`' do
find('#js-dropdown-assignee .filter-dropdown-item', text: 'Any').click
expect(page).to have_css(js_dropdown_emoji, visible: false)
expect_tokens([emoji_token('any')])
expect_filtered_search_input_empty
end
it 'fills in the my-reaction name' do
click_emoji('thumbsup')
......
......@@ -360,6 +360,22 @@ describe IssuesFinder do
end
context 'filtering by reaction name' do
context 'user searches by no reaction' do
let(:params) { { my_reaction_emoji: 'None' } }
it 'returns issues that the user did not react to' do
expect(issues).to contain_exactly(issue2, issue4)
end
end
context 'user searches by any reaction' do
let(:params) { { my_reaction_emoji: 'Any' } }
it 'returns issues that the user reacted to' do
expect(issues).to contain_exactly(issue1, issue3)
end
end
context 'user searches by "thumbsup" reaction' do
let(:params) { { my_reaction_emoji: 'thumbsup' } }
......
......@@ -196,14 +196,24 @@ describe API::Issues do
expect_paginated_array_response(size: 3)
end
it 'returns issues reacted by the authenticated user by the given emoji' do
it 'returns issues reacted by the authenticated user' do
issue2 = create(:issue, project: project, author: user, assignees: [user])
award_emoji = create(:award_emoji, awardable: issue2, user: user2, name: 'star')
get api('/issues', user2), my_reaction_emoji: award_emoji.name, scope: 'all'
create(:award_emoji, awardable: issue, user: user2, name: 'thumbsup')
expect_paginated_array_response(size: 1)
expect(first_issue['id']).to eq(issue2.id)
get api('/issues', user2), my_reaction_emoji: 'Any', scope: 'all'
expect_paginated_array_response(size: 2)
end
it 'returns issues not reacted by the authenticated user' do
issue2 = create(:issue, project: project, author: user, assignees: [user])
create(:award_emoji, awardable: issue2, user: user2, name: 'star')
get api('/issues', user2), my_reaction_emoji: 'None', scope: 'all'
expect_paginated_array_response(size: 2)
end
it 'returns issues matching given search string for title' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment