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)

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.

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.