fixed test and logic

This commit is contained in:
Aster Fialla
2026-02-18 08:47:37 -05:00
parent f0ac02e86d
commit e16694ac2d
2 changed files with 5 additions and 5 deletions

View File

@@ -121,7 +121,7 @@ mh.updateName = async function (authorId, args) {
const name = args[2];
if (!name) {
return `The name for ${name} is ${name}, but you probably knew that!`;
return `The name for ${args[0]} is ${args[0]}, but you probably knew that!`;
}
const trimmedName = name.trim();
if (trimmedName === '') {

View File

@@ -186,12 +186,12 @@ describe('MemberHelper', () => {
test('Sends string when no name', async () => {
// Arrange
const args = ['somePerson', 'name']
const args = ['somePerson', 'name'];
const expected = `The name for ${args[0]} is ${args[0]}, but you probably knew that!`;
// Act
memberHelper.updateName(authorId, args).catch((result) => {
// Assert
expect(result).toEqual(new RangeError("Name " + enums.err.NO_VALUE));
memberHelper.updateName(authorId, args).then((result) => {
expect(result).toEqual(expected);
})
})