Repository navigation
Cape Town | 26-ITP-Sept | Leigh Ross | Sprint 2 | Implement and rewrite tests - #1683
leigh-ross wants to merge 10 commits into
Conversation
| test(`should return "Right angle" when (angle = 90)`, () => { | ||
| expect(getAngleType(90)).toEqual("Right angle"); | ||
| }); |
There was a problem hiding this comment.
You might be interested to hear that Jest also comes with a describe function! Often when unit testing you might see:
describe("functionName", () => {
test("should return... ", () => {
// test body...
})
test("should return... ", () => {
// test body...
})
})This is not a required change but I thought you'd be interested to know!
There was a problem hiding this comment.
ah, I just realised you used Jest's describe below 😄
There was a problem hiding this comment.
While you have brought that up I wanted to know if it is good practice to use the describe function for only 1 test case? I like having my edge cases separate which is why they are alone in the code. What do you think about it?
|
@leigh-ross Hi Leigh! Great work overall on this coursework but I have left a few changes you need to look into. In general, you should always make sure to run your tests before committing - you don't want to be committing work that isn't passing tests! A quick note on your commits: I really appreciate you committing once per function, I think that is a good practice for using commits to track when some unit of work is complete. The commit messages could use a little bit of improvement for you to consider in the future. I would try to write commit messages by stating what the commit will change if it is merged (I know we don't merge PRs at CYF, but in a workplace you would). Imagine they are following on from the phrase "this commit will...", for example instead of:
You could say
You don't need to make these changes as part of this PR but bear it in mind for future :) |
…, Adapted test suites for node and jest to test the new logic correctly. All tests pass.
…dded error for both if conditions do not pass. Added tests in node and jest for the incorrect suit case and error throwing. All tests pass.
Learners, PR Template
Self checklist
Task code
CYF-1059
Changelist
Added 3 functions:
Added node tests for each Function.
Rewrote node tests for jest.