DEV: Fix flaky core backend spec (#22650)

Why this change?

The user id in a fixture file was hardcoded to 666. Once we've
fabricated enough user objects until the sequence for `User#id` reaches
666, the specs in vanilla_body_parser_spec.rb will fail.

What is the fix here?

This commit increases the user id to a large integer which we will
likely never hit in the next 10-20 years.
This commit is contained in:
Alan Guo Xiang Tan
2023-07-18 07:01:19 +08:00
committed by GitHub
parent e30b7776e7
commit d9a7779811
2 changed files with 5 additions and 2 deletions

View File

@@ -96,6 +96,7 @@ this starts with spaces but IS NOT a quote" \
{ "Format" => "Rich", "Body" => rich_bodies[:mention].to_json },
user_id,
).parse
expect(parsed).to eq "@Gandalf The Grey, what do you think?"
end
@@ -107,9 +108,10 @@ this starts with spaces but IS NOT a quote" \
name: "Gandalf The Grey",
username: "gandalf_the_grey",
)
lookup.add_user(mentioned.id.to_s, mentioned)
body = rich_bodies[:mention].to_json.gsub("666", mentioned.id.to_s)
body = rich_bodies[:mention].to_json.gsub("999999999", mentioned.id.to_s)
parsed = VanillaBodyParser.new({ "Format" => "Rich", "Body" => body }, user_id).parse
expect(parsed).to eq "@gandalf_the_grey, what do you think?"
end
@@ -120,6 +122,7 @@ this starts with spaces but IS NOT a quote" \
{ "Format" => "Rich", "Body" => rich_bodies[:links].to_json },
user_id,
).parse
expect(
parsed,
).to eq "We can link to the <a href=\"https:\/\/www.discourse.org\/\">Discourse home page</a> and it works."