FIX: Error modal not showing data (#225)
* FIX: Error modal not showing data Before, there was an issue where the error modal was not showing the data. This was because the error modal was not being shown when there were errors. * DEV: add tests to ensure that error modal is showing data
This commit is contained in:
parent
464ce019b5
commit
19766fbc09
|
@ -1,4 +1,4 @@
|
|||
<DModal @closeModal={{@closeModal}} id="chat_integration_error_modal">
|
||||
<h4>{{i18n @model.error_key}}</h4>
|
||||
<pre>{{@model.error_info}}</pre>
|
||||
<h4>{{i18n @model.channel.error_key}}</h4>
|
||||
<pre>{{@model.channel.error_info}}</pre>
|
||||
</DModal>
|
|
@ -1,8 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
require_relative "../dummy_provider"
|
||||
|
||||
RSpec.describe "Create channel", type: :system do
|
||||
fab!(:admin)
|
||||
|
||||
include_context "with dummy provider"
|
||||
let(:manager) { ::DiscourseChatIntegration::Manager }
|
||||
let(:chan1) { DiscourseChatIntegration::Channel.create!(provider: "dummy") }
|
||||
let(:category) { Fabricate(:category) }
|
||||
let(:topic) { Fabricate(:topic, category_id: category.id) }
|
||||
let(:first_post) { Fabricate(:post, topic: topic) }
|
||||
|
||||
before do
|
||||
SiteSetting.chat_integration_enabled = true
|
||||
SiteSetting.chat_integration_discord_enabled = true
|
||||
|
@ -23,4 +31,25 @@ RSpec.describe "Create channel", type: :system do
|
|||
expect(page).to have_css(".channel-details")
|
||||
expect(find(".channel-info")).to have_content("bloop")
|
||||
end
|
||||
|
||||
it "shows error in chanel modal" do
|
||||
DiscourseChatIntegration::Rule.create!(
|
||||
channel: chan1,
|
||||
filter: "watch",
|
||||
category_id: category.id,
|
||||
)
|
||||
|
||||
visit("/admin/plugins/chat-integration/dummy")
|
||||
|
||||
provider.set_raise_exception(
|
||||
DiscourseChatIntegration::ProviderError.new info: { error_key: "hello" }
|
||||
)
|
||||
manager.trigger_notifications(first_post.id)
|
||||
expect(find(".error-message")).to have_content(
|
||||
I18n.t("js.chat_integration.channels_with_errors"),
|
||||
)
|
||||
|
||||
find(".channel-title").find("button").click
|
||||
expect(page).to have_content "{\n \"error_key\": \"hello\"\n}"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue