Skip to main content

Milestone 2 FAQs and Edits

This is a collection of issues that students have found when working with the existing milestone-2 template. You can see the other changes to the template repo here - I won't be pushing any other updates to repo.

Here's the latest edit, although if you already got it working, you don't need to change anything.

class-code-questions.test.mjs Line 49

  it("POST /api/class-codes/:class-codes/question returns 201 when a new question is created", async () => {
- let response = await req.post(`/api/class-codes/test-class/question`);
+ let response = await req.post(`/api/class-codes/test-class/question`)
+ .send({ name: 'anon', question: 'This is a test question'});
expect(response.statusCode).toBe(201);
expect(response.body.id).not.toBe(null);

// logout and create a question as a logged out user
- await req.get("/api/logout");
+ await signOut(req)

// create a question as a signed out user
response = await req
.post(`/api/class-codes/test-class/question`)
.send({ question: "why is the sky blue", name: "anon" });
expect(response.statusCode).toBe(201);
expect(response.body.question).toEqual("why is the sky blue");
});

There are bugs and/or mistakes across the assignment. Is it me or is it the assignment?

Probably a little bit of both!

Arguably, debugging and finding those mistakes is more learning than I could have ever designed on purpose. But I understand its annoying none-the-less.

That said, they aren't there by intention. If you're confused by parts of the assignment:

  • thanks for raising them
  • use your best judgement to move forward
  • shoot me an email and ask

can we add functions to database.js?

Yes.

I get an error when I run npm install

  • Make sure you are using Node v18 - you can go back to Setup your dev environment
  • Delete your node_modules folder: rm -rf node_modules/ (on linux)
  • Delete package-lock.json: rm package-lock.json

I'm having trouble running git push and/or git pull

You might be having trouble pulling in the changes that I pushed to your repo, after you initially accepted the Github Classroom assignment.

You can run git pull --rebase origin main to pull in the latest changes. If that doesn't work, read the guide below to understand the steps you need to do in the Git guide

It is time consuming to manually upload each file to GitHub via the Web Browser

If you are uploading files individually to GitHub via the Web Browser, you are not using GitHub or Git correctly. Read the Git guide to understand how to use it properly.