This repository was archived by the owner on Jan 14, 2024. It is now read-only.
generated from CodeYourFuture/CYF-Coursework-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 267
Jan_Softa_London10_Javascript_Core_2_Week1 #226
Open
softacoder
wants to merge
1
commit into
CodeYourFuture:main
Choose a base branch
from
softacoder:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,16 @@ function formatCourseworkResult(trainee) { | |
| score: 63 | ||
| } | ||
| */ | ||
| function convertScoreToGrade(score) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Think you might have a bit of stray code copied from above? You can delete this and up till the beginning of line 61 to fix |
||
| let grade = null; | ||
|
|
||
| if (score >= 80) {test("checks the output of formatCourseworkResult", () => { | ||
| let trainee = { | ||
| name: "Xin", | ||
| score: 63, | ||
| }; | ||
| expect(formatCourseworkResult(trainee)).toEqual("Xin's coursework was marked as grade C."); | ||
| }); | ||
|
|
||
| /* | ||
| Write a test that checks the output of formatCourseworkResult when passed the following trainee: | ||
|
|
@@ -63,6 +73,13 @@ function formatCourseworkResult(trainee) { | |
| score: 78 | ||
| } | ||
| */ | ||
| test("checks the output of formatCourseworkResult", () => { | ||
| let trainee = { | ||
| name: "Mona", | ||
| score: 78, | ||
| }; | ||
| expect(formatCourseworkResult(trainee)).toEqual("Mona's coursework was marked as grade B."); | ||
| }); | ||
|
|
||
| /* | ||
| Write a test that checks the output of formatCourseworkResult when passed the following trainee: | ||
|
|
@@ -74,13 +91,31 @@ function formatCourseworkResult(trainee) { | |
| } | ||
| */ | ||
|
|
||
| test("checks the output of formatCourseworkResult", () => { | ||
| let trainee = { | ||
| name: "Ali", | ||
| score: 49, | ||
| age: 33, | ||
| subjects: ["JavaScript", "React", "CSS"], | ||
| }; | ||
| expect(formatCourseworkResult(trainee)).toEqual("Ali's coursework was marked as grade E."); | ||
| }); | ||
|
|
||
| /* | ||
| Write a test that checks the output of formatCourseworkResult when passed the following trainee: | ||
| { | ||
| score: 90, | ||
| age: 29 | ||
| } | ||
| */ | ||
| test("checks the output of formatCourseworkResult", () => { | ||
| let trainee = { | ||
| score: 90, | ||
| age: 29, | ||
| }; | ||
| expect(formatCourseworkResult(trainee)).toEqual("Error: No trainee name!"); | ||
| }); | ||
|
|
||
|
|
||
| /* | ||
| Write a test that checks the output of formatCourseworkResult when passed the following trainee: | ||
|
|
@@ -89,3 +124,11 @@ function formatCourseworkResult(trainee) { | |
| subjects: ["HTML", "CSS", "Databases"] | ||
| } | ||
| */ | ||
|
|
||
| test("checks the output of formatCourseworkResult", () => { | ||
| let trainee = { | ||
| name: "Aman", | ||
| subjects: ["HTML", "CSS", "Databases"], | ||
| }; | ||
| expect(formatCourseworkResult(trainee)).toEqual("Error: Coursework percent is not a number!"); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good and works but this is the shorthand approach of adding a method into an object, just to check understanding, do you know how you would define this method without using the shorthand approach? Ie by defining fully the key and the value separately?