mirror of
https://github.com/discourse/discourse.git
synced 2025-06-07 21:44:42 +08:00
DEV: fixes flakey due to unordered array (#22515)
The `message_bus_channels` given to `MessageBus.last_ids(*message_bus_channels)` is not ordered, as a result the expectation of the tests could fail, this test ensures we check the contain of the input instead of content+order.
This commit is contained in:
@ -135,7 +135,8 @@ RSpec.describe Chat::StructuredChannelSerializer do
|
|||||||
it "calls MessageBus.last_ids with all the required channels for each public and DM chat chat channel" do
|
it "calls MessageBus.last_ids with all the required channels for each public and DM chat chat channel" do
|
||||||
MessageBus
|
MessageBus
|
||||||
.expects(:last_ids)
|
.expects(:last_ids)
|
||||||
.with(
|
.with do |*args|
|
||||||
|
[
|
||||||
Chat::Publisher::CHANNEL_METADATA_MESSAGE_BUS_CHANNEL,
|
Chat::Publisher::CHANNEL_METADATA_MESSAGE_BUS_CHANNEL,
|
||||||
Chat::Publisher::CHANNEL_EDITS_MESSAGE_BUS_CHANNEL,
|
Chat::Publisher::CHANNEL_EDITS_MESSAGE_BUS_CHANNEL,
|
||||||
Chat::Publisher::CHANNEL_STATUS_MESSAGE_BUS_CHANNEL,
|
Chat::Publisher::CHANNEL_STATUS_MESSAGE_BUS_CHANNEL,
|
||||||
@ -156,8 +157,10 @@ RSpec.describe Chat::StructuredChannelSerializer do
|
|||||||
Chat::Publisher.new_messages_message_bus_channel(channel4.id),
|
Chat::Publisher.new_messages_message_bus_channel(channel4.id),
|
||||||
Chat::Publisher.new_mentions_message_bus_channel(channel4.id),
|
Chat::Publisher.new_mentions_message_bus_channel(channel4.id),
|
||||||
Chat::Publisher.root_message_bus_channel(channel4.id),
|
Chat::Publisher.root_message_bus_channel(channel4.id),
|
||||||
)
|
].to_set == args.to_set
|
||||||
|
end
|
||||||
.returns({})
|
.returns({})
|
||||||
|
|
||||||
described_class.new(fetch_data, scope: guardian).as_json
|
described_class.new(fetch_data, scope: guardian).as_json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user