refactor(ui): give every message one friendly, ungendered voice
Members read all replies as one voice, so the wording now lives in one place:
the shared titles, the list marker and the "what to do next" hint come from
src/ui/embeds.js, and every module follows them.
An error explains the cause, recalls the rule and offers the way out instead of
blaming; a success says what happens next. Nothing agrees on the gender of a
person ("utilisateur", "cher/chère", "ravie"), which also keeps the sentences
shorter. Two tests lock the shared titles and reject gendered descriptions.
This commit is contained in:
31 files changed
+469
-201
No files matched your search
@@ -46,6 +46,34 @@ describe('command modules', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('message tone', () => {
|
||||
it('builds every embed with the shared titles, marker and hint', async () => {
|
||||
const { TONE, bullets, errorEmbed, successEmbed, warningEmbed, withHint } =
|
||||
await import('../src/ui/embeds.js');
|
||||
|
||||
assert.equal(successEmbed('x').data.title, TONE.success);
|
||||
assert.equal(errorEmbed('x').data.title, TONE.error);
|
||||
assert.equal(warningEmbed('x').data.title, TONE.warning);
|
||||
assert.equal(bullets(['a', 'b', '']), '• a\n• b');
|
||||
assert.equal(withHint('fait', 'ensuite'), 'fait\n\nensuite');
|
||||
assert.equal(withHint('fait', null), 'fait');
|
||||
});
|
||||
|
||||
it('keeps command descriptions free of gendered wording', async () => {
|
||||
/** Words that would address or describe a person with a gender. */
|
||||
const gendered =
|
||||
/\b(utilisateur|utilisatrice|cher|chère|ravi|ravie|content|contente|bienvenu|bienvenue à (lui|elle))/i;
|
||||
|
||||
for (const command of await loadCommands()) {
|
||||
const json = command.data.toJSON();
|
||||
const texts = [json.description, ...(json.options ?? []).map((option) => option.description ?? '')];
|
||||
for (const text of texts) {
|
||||
assert.ok(!gendered.test(text), `/${json.name} uses gendered wording: ${text}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('webhook entry points', () => {
|
||||
it('exposes the server and the dispatch functions', async () => {
|
||||
const server = await import('../src/webhooks/server.js');
|
||||
|
||||
@@ -9,11 +9,11 @@ describe('parseChoices', () => {
|
||||
});
|
||||
|
||||
it('rejects a single choice', () => {
|
||||
assert.throws(() => parseChoices('Oui'), /entre 2 et 10 choix/);
|
||||
assert.throws(() => parseChoices('Oui'), /entre 2 et 10 propositions/);
|
||||
});
|
||||
|
||||
it('rejects duplicated choices regardless of case', () => {
|
||||
assert.throws(() => parseChoices('Oui;oui'), /différents/);
|
||||
assert.throws(() => parseChoices('Oui;oui'), /Deux propositions identiques/);
|
||||
});
|
||||
|
||||
it('rejects more choices than allowed', () => {
|
||||
@@ -42,7 +42,7 @@ describe('buildPollEmbed', () => {
|
||||
{ choice_index: 0, count: 3 },
|
||||
{ choice_index: 1, count: 1 },
|
||||
]);
|
||||
assert.equal(embed.data.title, 'Sondage #3 — Quel thème ?');
|
||||
assert.equal(embed.data.title, '📊 Sondage #3 — Quel thème ?');
|
||||
assert.match(embed.data.description, /Clair/);
|
||||
assert.match(embed.data.description, /3 \(75 %\)/);
|
||||
assert.equal(embed.data.fields[0].value, '4');
|
||||
|
||||
Reference in new issue
Block a user