Exercise Tracker Project with testable user stories - Guinea Pigs needed šŸ¹

This project will be part of our new Quality Assurance and Information Security section. It was designed by @JosephLivengood.

The goal is for campers to be able to build these projects step by step following user stories. This will make the projects less intimidating and more fun. Oh, and donā€™t worry - weā€™ll still have plenty of optional projects where we donā€™t provide you with any tests. And if youā€™ve previously built these projects, you donā€™t need to build them again.

If youā€™re interested in attempting this, please reply to the thread and let us know youā€™ve started it. The more people who want to build this, the better, as we can start gathering feedback.

Thanks, and happy coding!

User Stories

  • I can create a user by posting form data username to /api/exercise/new-user and returned will be an object with username and _id.
  • I can get an array of all users by getting api/exercise/users with the same info as when creating a user.
  • I can add an exercise to any user by posting form data userId(_id), description, duration, and optionally date to /api/exercise/add. If no date supplied it will use current date. Returned will the the user object with also with the exercise fields added.
  • I can retrieve a full exercise log of any user by getting /api/exercise/log with a parameter of userId(_id). Return will be the user object with added array log and count (total exercise count).
  • I can retrieve part of the log of any user by also passing along optional parameters of from & to or limit. (Date format yyyy-mm-dd, limit = int)

Tester (MS6- Exercise Tracker): https://pricey-hugger.gomix.me/

Passing prototype: https://gomix.com/#!/project/fuschia-custard

Boilerplate to start with: https://gomix.com/#!/project/fcc-message

Iā€™ve been working on this today and, while it really needs some refactoring, Iā€™ve almost satisfied the requirements. However, most of the time it passes, even though I havenā€™t even started to deal with the fifth test yet:

5.I can retrieve part of the log of any user by also passing along optional parameters of from & to or limit. (Date format yyyy-mm-dd, limit = int)

Despite this not being implemented, usually all 5 tests pass. If they pass the first time, you can restart the tests if you just keep clicking the ā€œNext testā€ button. It may take several cycles through the tests, but eventually I get an error like:

AssertionError: log should have supplied length: expected [ Array(2) ] to have a length of 1 but got 2

While making this, I tested it frequently and each of the other tests failed when they should have. So, for me, it is only the fifth test that isnā€™t specific enough.

Hereā€™s the link: Glitch :ļ½„ļ¾Ÿāœ§

A couple other notes:

The challenge page on beta doesnā€™t mention the user stories/requirements, and Iā€™m not sure why the boilerplate provided is for a message board application. Fortunately I found this thread which had links to all the info I needed.
FWIW, I ended up just using gomixā€™s default boilerplate, and the only changes I needed to do to accomodate the tests here was to install cors and add

const cors = require('cors');
app.use(cors({origin: '*'}));

to my server.js.

So far, Iā€™m really enjoying working with these specific tests in mind - itā€™s nice checking off the marks, knowing that youā€™ve satisfied the requirements. On the other hand Iā€™m kinda dreading converting all my current data-viz/react challenges to work with the tests (Iā€™ve done everything but dungeon crawler, so I havenā€™t gotten the cert yet). But, it is what it is, and I really appreciate what yā€™all are doing here.

Does the project need to be deployed to GoMix to satisfy the tests? I built this project locally and then deployed to Heroku, but when I link to the project using the testing page (https://pricey-hugger.gomix.me/) all the tests fail.

How does the testing actually work? I thought it would just hit all the API endpoints of the specified project and then pass/fail tests based on the responses.

EDIT:

Ignore all of that, Iā€™d forgotten to enable CORS. All tests pass now. I quite like the new system, for what itā€™s worth.

Project link is here: https://tom-p-uk-exercise-tracker.herokuapp.com/

1 Like

@tom-p-uk

Could you share your repo for this project?

Iā€™m currently working on the project and Iā€™m stuck.