From 7e7b192f64b7ebf8a05bc3cfb0f8832fb1ce01d4 Mon Sep 17 00:00:00 2001 From: Nazareno Bucciarelli <84046180+nazabucciarelli@users.noreply.github.com> Date: Tue, 3 Mar 2026 00:09:14 -0300 Subject: [PATCH] test: stabilize storage settings reactivity emojis/sounds tests (#39172) --- apps/meteor/app/settings/server/CachedSettings.ts | 12 +++++++++--- apps/meteor/tests/end-to-end/api/custom-sounds.ts | 3 +-- apps/meteor/tests/end-to-end/api/emoji-custom.ts | 3 +-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/meteor/app/settings/server/CachedSettings.ts b/apps/meteor/app/settings/server/CachedSettings.ts index 3c46dd05a68..8332f45c5c4 100644 --- a/apps/meteor/app/settings/server/CachedSettings.ts +++ b/apps/meteor/app/settings/server/CachedSettings.ts @@ -181,9 +181,15 @@ export class CachedSettings const settings = _id.map((id) => this.store.get(id)?.value); callback(settings as T[]); } - const mergeFunction = _.debounce((): void => { - callback(_id.map((id) => this.store.get(id)?.value) as T[]); - }, 100); + + const mergeFunction = + process.env.TEST_MODE !== 'true' + ? _.debounce((): void => { + callback(_id.map((id) => this.store.get(id)?.value) as T[]); + }, 100) + : (): void => { + callback(_id.map((id) => this.store.get(id)?.value) as T[]); + }; const fns = _id.map((id) => this.on(id, mergeFunction)); return (): void => { diff --git a/apps/meteor/tests/end-to-end/api/custom-sounds.ts b/apps/meteor/tests/end-to-end/api/custom-sounds.ts index 2abb62b8fae..b035a5d6fec 100644 --- a/apps/meteor/tests/end-to-end/api/custom-sounds.ts +++ b/apps/meteor/tests/end-to-end/api/custom-sounds.ts @@ -260,6 +260,7 @@ describe('[CustomSounds]', () => { let gridFsFileId: string; before(async () => { + await updateSetting('CustomSounds_FileSystemPath', '', false); await updateSetting('CustomSounds_Storage_Type', 'FileSystem'); fsFileId = await insertOrUpdateSound(`${fileName}-3`); await uploadCustomSound(binary, `${fileName}-3`, fsFileId); @@ -267,8 +268,6 @@ describe('[CustomSounds]', () => { await updateSetting('CustomSounds_Storage_Type', 'GridFS'); gridFsFileId = await insertOrUpdateSound(`${fileName}-4`); await uploadCustomSound(binary, `${fileName}-4`, gridFsFileId); - - await updateSetting('CustomSounds_FileSystemPath', ''); }); after(async () => { diff --git a/apps/meteor/tests/end-to-end/api/emoji-custom.ts b/apps/meteor/tests/end-to-end/api/emoji-custom.ts index 57ec2570eb2..b256fd4b545 100644 --- a/apps/meteor/tests/end-to-end/api/emoji-custom.ts +++ b/apps/meteor/tests/end-to-end/api/emoji-custom.ts @@ -497,13 +497,12 @@ describe('[EmojiCustom]', () => { `); before(async () => { + await updateSetting('EmojiUpload_FileSystemPath', '', false); await updateSetting('EmojiUpload_Storage_Type', 'FileSystem'); await request.post(api('emoji-custom.create')).set(credentials).attach('emoji', imgURL).field({ name: fsEmojiName }).expect(200); await updateSetting('EmojiUpload_Storage_Type', 'GridFS'); await request.post(api('emoji-custom.create')).set(credentials).attach('emoji', imgURL).field({ name: gridFsEmojiName }).expect(200); - - await updateSetting('EmojiUpload_FileSystemPath', ''); }); after(async () => {