Skip to content

diy-data finished#14

Open
mmarla wants to merge 1 commit intoCommandShiftHQ:mainfrom
SteveNelson83:master
Open

diy-data finished#14
mmarla wants to merge 1 commit intoCommandShiftHQ:mainfrom
SteveNelson83:master

Conversation

@mmarla
Copy link

@mmarla mmarla commented Jun 21, 2019

No description provided.

@@ -1,5 +1,5 @@
const booleanToWord = (boolean) => {

return (boolean ? 'Yes' : 'No');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good use of a ternary operator. Concise and effective.

if (number % 3 === 0) {
return 'Fizz'
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 3 separate if statements, one else if or switch statement would have been more concise here. Code works though and passes the tests.


}
const numberToReversedDigits = (number) =>
number.toString().split('').map(Number).reverse();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, concise and effective.

} newArray.push(24 + ((number - 2) * 4))
newArray.push(24 + ((number - 2) * 5))
return newArray
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this code passes the tests you wrote, unfortunately it doesn't stand up to any robust or dynamic testing. If the user enters a number you haven't hardcoded in here, the code will fail as will the tests.

it('returns array of cat, human and dog ages even if less than 3', () => {
expect(humanCatDogYears(2)).toEqual([2, 24, 24])
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests are fine and work accordingly but should the user enter a 0, negative number, a 3 or upwards, the code that passes these tests will fail. Ensure your tests have more robust coverage.


const reachDestination = (distance, speed) => {
return `I should be there in ${Math.round((distance / speed) * 2) / 2} hours`;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code passes the test that was written but could be more accurate.


expect(reachDestination(44, 10)).toEqual('I should be there in 4.5 hours')
});
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More robust testing needed for edge cases.

}

module.exports = joinNames;
module.exports = joinNames No newline at end of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well. Effective and clean code.

return employees[i].role;
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really concise and effective code. Well done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants