Skip to content

A platform for community discussion. Free, open, simple.

DEV: Silence one more test (#17375)

Jarek Radosz94c70a0909be
diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js
index 23de74d4fa5..673896bf3a1 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js
@@ -389,7 +389,12 @@ acceptance("Uppy Composer Attachment - Upload Error", function (needs) {
test("should show an error message for the failed upload", async function (assert) {
// Don't log the upload error
- sinon.stub(console, "error");
+ const stub = sinon
+ .stub(console, "error")
+ .withArgs(
+ sinon.match(/\[Uppy\]/),
+ sinon.match(/Failed to upload avatar\.png/)
+ );
await visit("/");
await click("#create-topic");
@@ -398,6 +403,7 @@ acceptance("Uppy Composer Attachment - Upload Error", function (needs) {
const done = assert.async();
appEvents.on("composer:upload-error", async () => {
+ sinon.assert.calledOnce(stub);
assert.strictEqual(
query(".bootbox .modal-body").innerHTML,
"There was an error uploading the file, the gif was way too cool.",
diff --git a/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js b/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js
index 90e9dae7f0d..b9e529f3e48 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js
@@ -16,12 +16,15 @@ acceptance("Category 404", function (needs) {
test("Navigating to a bad category link does not break the router", async function (assert) {
// Don't log the XHR error
- sinon.stub(console, "error");
+ const stub = sinon
+ .stub(console, "error")
+ .withArgs(sinon.match({ status: 404 }));
await visit("/t/internationalization-localization/280");
await click('[data-for-test="category-404"]');
assert.strictEqual(currentURL(), "/404");
+ sinon.assert.calledOnce(stub);
// See that we can navigate away
await click("#site-logo");
diff --git a/app/assets/javascripts/discourse/tests/unit/services/presence-test.js b/app/assets/javascripts/discourse/tests/unit/services/presence-test.js
index 40e07a66c3d..9d44ebb90ee 100644
--- a/app/assets/javascripts/discourse/tests/unit/services/presence-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/services/presence-test.js
@@ -5,6 +5,7 @@ import {
import { test } from "qunit";
import { PresenceChannelNotFound } from "discourse/services/presence";
import { setTestPresence } from "discourse/lib/user-presence";
+import sinon from "sinon";
function usersFixture() {
return [
@@ -122,6 +123,12 @@ acceptance("Presence - Subscribing", function (needs) {
"updates following messagebus message"
);
+ const stub = sinon
+ .stub(console, "log")
+ .withArgs(
+ "PresenceChannel '/test/ch1' dropped message (received 99, expecting 3), resyncing..."
+ );
+
publishToMessageBus(
"/presence/test/ch1",
{
@@ -133,6 +140,7 @@ acceptance("Presence - Subscribing", function (needs) {
await channel._presenceState._resubscribePromise;
+ sinon.assert.calledOnce(stub);
assert.strictEqual(
channel.users.length,
3,