fix: don't crash if event name is not a string

This commit is contained in:
Barış Soner Uşaklı
2023-03-27 10:38:53 -04:00
parent e9a8e19508
commit 37b48b82a4
2 changed files with 15 additions and 1 deletions

View File

@@ -107,6 +107,15 @@ describe('socket.io', () => {
});
});
it('should return error for invalid eventName type', (done) => {
const eventName = ['topics.loadMoreTags'];
io.emit(eventName, function (err) {
const eventAsString = String(eventName);
assert.strictEqual(err.message, `[[error:invalid-event, ${eventAsString}]]`);
done();
});
});
it('should get installed themes', (done) => {
const themes = ['nodebb-theme-lavender', 'nodebb-theme-persona', 'nodebb-theme-vanilla'];
io.emit('admin.themes.getInstalled', (err, data) => {