Command Shift

Checkup

We can now feed and walk our pets, but how do we know when we need to?

Your challenge in this step is to give the Pet function a checkUp method that lets you know how the pet is feeling.

  • if the pet's fitness is 3 or less, it should return 'I need a walk'.

  • if the pet's hunger is 5 or more, it should return 'I am hungry'.

  • if both of the above are true, it should return 'I am hungry AND I need a walk'

  • if neither of the above are true, it should return 'I feel great!'

To complete this challenge, you will need to:

  • test the expected behaviour in the Node CLI

  • write unit tests to to cover the expected behaviour

  • implement the code to make the tests pass

  • refactor your code

Once you are done, commit your work, push to GitHub. :twisted_rightwards_arrows:

Walkthrough

There is no walkthrough for this step... you can do it!

On this page