test: stabilize storage settings reactivity emojis/sounds tests (#39172)

pull/39439/head
Nazareno Bucciarelli 1 week ago committed by GitHub
parent c57c262cdf
commit 7e7b192f64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      apps/meteor/app/settings/server/CachedSettings.ts
  2. 3
      apps/meteor/tests/end-to-end/api/custom-sounds.ts
  3. 3
      apps/meteor/tests/end-to-end/api/emoji-custom.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 => {

@ -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 () => {

@ -497,13 +497,12 @@ describe('[EmojiCustom]', () => {
</svg>`);
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 () => {

Loading…
Cancel
Save