mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 18:22:40 +08:00
FEATURE: PWA compatibility checks in the Dashboard (#6850)
This commit is contained in:

committed by
Guo Xiang Tan

parent
09cbd08c64
commit
f73fe36772
@ -192,6 +192,52 @@ describe AdminDashboardData do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pwa_config_check' do
|
||||
subject { described_class.new.pwa_config_check }
|
||||
|
||||
it 'alerts for large_icon missing' do
|
||||
SiteSetting.large_icon = nil
|
||||
expect(subject).to eq(I18n.t('dashboard.pwa_config_icon_warning', base_path: Discourse.base_path))
|
||||
end
|
||||
|
||||
it 'alerts for incompatible large_icon' do
|
||||
upload = UploadCreator.new(
|
||||
file_from_fixtures('large_icon_incorrect.png'),
|
||||
'large_icon',
|
||||
for_site_setting: true
|
||||
).create_for(Discourse.system_user.id)
|
||||
SiteSetting.large_icon = upload
|
||||
expect(subject).to eq(I18n.t('dashboard.pwa_config_icon_warning', base_path: Discourse.base_path))
|
||||
end
|
||||
|
||||
context 'when large_icon is correct' do
|
||||
before do
|
||||
upload = UploadCreator.new(
|
||||
file_from_fixtures('large_icon_correct.png'),
|
||||
'large_icon',
|
||||
for_site_setting: true
|
||||
).create_for(Discourse.system_user.id)
|
||||
SiteSetting.large_icon = upload
|
||||
end
|
||||
|
||||
it 'alerts for short_title missing' do
|
||||
SiteSetting.short_title = nil
|
||||
expect(subject).to eq(I18n.t('dashboard.pwa_config_title_warning', base_path: Discourse.base_path))
|
||||
end
|
||||
|
||||
it 'returns nil when everything is ok' do
|
||||
upload = UploadCreator.new(
|
||||
file_from_fixtures('large_icon_correct.png'),
|
||||
'large_icon',
|
||||
for_site_setting: true
|
||||
).create_for(Discourse.system_user.id)
|
||||
SiteSetting.large_icon = upload
|
||||
SiteSetting.short_title = 'title'
|
||||
expect(subject).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 's3_config_check' do
|
||||
shared_examples 'problem detection for s3-dependent setting' do
|
||||
subject { described_class.new.s3_config_check }
|
||||
|
Reference in New Issue
Block a user