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.