1# frozen_string_literal: true
2
3require 'spec_helper'
4
5RSpec.describe NotificationsHelper do
6  describe 'notification_icon' do
7    it { expect(notification_icon(:disabled)).to match('data-testid="notifications-off-icon"') }
8    it { expect(notification_icon(:owner_disabled)).to match('data-testid="notifications-off-icon"') }
9    it { expect(notification_icon(:participating)).to match('data-testid="notifications-icon"') }
10    it { expect(notification_icon(:mention)).to match('data-testid="at-icon"') }
11    it { expect(notification_icon(:global)).to match('data-testid="earth-icon') }
12    it { expect(notification_icon(:watch)).to match('data-testid="eye-icon"') }
13    it { expect(notification_icon(:custom)).to equal('') }
14  end
15
16  describe 'notification_title' do
17    it { expect(notification_title(:watch)).to match('Watch') }
18    it { expect(notification_title(:mention)).to match('On mention') }
19    it { expect(notification_title(:global)).to match('Global') }
20  end
21
22  describe '#notification_icon_level' do
23    let(:user) { create(:user) }
24    let(:global_setting) { user.global_notification_setting }
25    let(:notification_setting) { create(:notification_setting, level: :watch) }
26
27    it { expect(notification_icon_level(notification_setting, true)).to eq 'owner_disabled' }
28    it { expect(notification_icon_level(notification_setting)).to eq 'watch' }
29    it { expect(notification_icon_level(global_setting)).to eq 'participating' }
30  end
31end
32