forked from PluralFlux/PluralFlux
fixed test and logic
This commit is contained in:
@@ -121,7 +121,7 @@ mh.updateName = async function (authorId, args) {
|
|||||||
|
|
||||||
const name = args[2];
|
const name = args[2];
|
||||||
if (!name) {
|
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();
|
const trimmedName = name.trim();
|
||||||
if (trimmedName === '') {
|
if (trimmedName === '') {
|
||||||
|
|||||||
@@ -186,12 +186,12 @@ describe('MemberHelper', () => {
|
|||||||
|
|
||||||
test('Sends string when no name', async () => {
|
test('Sends string when no name', async () => {
|
||||||
// Arrange
|
// 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
|
// Act
|
||||||
memberHelper.updateName(authorId, args).catch((result) => {
|
memberHelper.updateName(authorId, args).then((result) => {
|
||||||
// Assert
|
expect(result).toEqual(expected);
|
||||||
expect(result).toEqual(new RangeError("Name " + enums.err.NO_VALUE));
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user