garageScript / c0d3-app

C0D3 - Become a Software Engineer the Hard Way
https://www.c0d3.com
MIT License
101 stars 69 forks source link

Write tests for all files and add all relevant files to code coverage #409

Closed songz closed 3 years ago

songz commented 4 years ago

This PR does not have tests: https://github.com/garageScript/c0d3-app/pull/401/files

And yet, coverage is 100%. This means many other pages probably lack tests as well.

For this issue, first figure out how to include pages to be tracked in code coverage.

Then, figure out how to be amazing and get coverage to a more sensible 100%

hwong0305 commented 3 years ago

Test needs to be written for the files below to covered all the lines before we can add all relevant files for code coverage. Please create individual PRs to close each file and tag this issue and we will cross it off as we go.

---------------------------- --------- ---------- --------- --------- ------------------- File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 74.98 73.12 69.85 74.72
components 91.95 95.41 90.7 92.43
AdditionalResources.tsx 100 100 100 100
Alert.tsx 100 100 100 100
AlertsDisplay.tsx 100 100 100 100
AnnouncementCard.tsx 100 100 100 100
AppNav.tsx 100 100 100 100
Card.tsx 100 100 100 100
ChallengeMaterial.tsx 100 100 100 100
ContributorCard.tsx 100 100 100 100
DropdownMenu.tsx 100 100 100 100
FilterButtons.tsx 100 100 100 100
Footer.tsx 100 100 100 100
FormCard.tsx 100 100 100 100
Input.tsx 100 100 100 100
InputGroup.tsx 100 100 100 100
LandingPage.tsx 100 100 100 100
Layout.tsx 100 100 100 100
LessonCard.tsx 100 100 100 100
LessonTitleCard.tsx 100 100 100 100
LoadingSpinner.tsx 100 100 100 100
MdInput.tsx 100 100 100 100
NavLink.tsx 100 100 100 100
ProfileImageInfo.tsx 100 100 100 100
ProfileLessons.tsx 100 100 100 100
ProfileSubmissions.tsx 100 100 100 100
ProgressCard.tsx 100 100 100 100
ReviewCard.tsx 0 0 0 0 22-93
SubmissionCard.tsx 100 100 100 100
UserInfoImage.tsx 100 100 100 100
components/admin 0 0 0 0
AdminLayout.tsx 0 0 0 0 7-34
components/admin/alerts 0 0 0 0
AdminNewAlert.tsx 0 0 0 0 20-73
components/admin/lessons 0 0 0 0
AdminLessonChallenges.tsx 0 0 0 0 15-169
AdminLessonInfo.tsx 0 0 0 0 33-164
AdminLessonsSideBar.tsx 0 0 0 0 11-38
components/admin/users 0 0 0 0
AdminUsersSplitSearch.tsx 0 0 0 0 4-22
AdminUsersTable.tsx 0 0 0 0 38-167
components/theme 100 100 100 100
Button.tsx 100 100 100 100
Text.tsx 100 100 100 100
colors.tsx 100 100 100 100
sizes.tsx 100 100 100 100
containers 100 100 100 100
withQueryLoader.tsx 100 100 100 100
graphql 0 0 0 0
resolvers.ts 0 0 0 0
typeDefs.ts 0 0 0 0
graphql/queries 38.89 100 100 38.89
acceptSubmission.ts 0 100 100 0 3
addAlert.ts 0 100 100 0 3
allUsers.ts 0 100 100 0 3
changeAdminRights.ts 0 100 100 0 3
createChallenge.ts 0 100 100 0 3
createLesson.ts 0 100 100 0 3
getApp.ts 100 100 100 100
getSubmissions.ts 100 100 100 100
loginUser.ts 100 100 100 100
logoutUser.ts 100 100 100 100
rejectSubmission.ts 0 100 100 0 3
removeAlert.ts 0 100 100 0 3
resetPassword.ts 100 100 100 100
signupUser.ts 100 100 100 100
updateChallenge.ts 0 100 100 0 3
updateLesson.ts 0 100 100 0 3
updatePassword.ts 100 100 100 100
userInfo.ts 0 100 100 0 3
graphql/queryResolvers 100 100 100 100
alerts.ts 100 100 100 100
allUsers.ts 100 100 100 100
getLessonMentors.ts 100 100 100 100
lessons.ts 100 100 100 100
session.ts 100 100 100 100
helpers 98.22 96 95.65 98.17
dbload.ts 100 100 100 100
encoding.ts 100 100 100 100
findUser.ts 100 100 100 100
formChange.ts 100 100 100 100
formValidation.tsx 100 100 100 100
isAdmin.ts 100 100 100 100
lessonExists.ts 100 100 100 100
mail.ts 100 100 100 100
mattermost.ts 100 100 100 100
noop.ts 100 100 100 100
splitWithSearchTerm.tsx 100 100 100 100
updateSubmission.ts 100 100 100 100
withApollo.ts 0 0 0 0 6-15
helpers/admin 100 100 100 100
adminHelpers.ts 100 100 100 100
helpers/controllers 100 100 100 100
adminController.ts 100 100 100 100
alertController.ts 100 100 100 100
authController.ts 100 100 100 100
challengesController.ts 100 100 100 100
lessonsController.ts 100 100 100 100
passwordController.ts 100 100 100 100
submissionController.ts 100 100 100 100
userInfoController.ts 100 100 100 100
helpers/middleware 100 100 100 100
logger.ts 100 100 100 100
user.ts 100 100 100 100
helpers/models 100 100 100 100
Alert.ts 100 100 100 100
Challenge.ts 100 100 100 100
Lesson.ts 100 100 100 100
Star.ts 100 100 100 100
Submission.ts 100 100 100 100
User.ts 100 100 100 100
UserLesson.ts 100 100 100 100
pages 83.8 79.59 78.13 83.09
404.tsx 0 100 0 0 5
_app.tsx 0 0 0 0 13-32
_error.tsx 0 0 0 0 12-61
book.tsx 0 100 0 0 3-8
contributors.tsx 100 100 100 100
curriculum.tsx 100 100 100 100
forgotpassword.tsx 100 100 100 100
index.tsx 100 100 100 100
login.tsx 100 100 100 100
signup.tsx 100 100 100 100
pages/admin 0 0 0 0
alerts.tsx 0 0 0 0 18-65
lessons.tsx 0 0 0 0 8-12
users.tsx 0 100 0 0 25-103
pages/api 100 100 100 100
graphql.ts 100 100 100 100
lessons.ts 100 100 100 100
pages/confirm 100 100 100 100
[token].tsx 100 100 100 100
pages/curriculum 100 100 100 100
[lesson].tsx 100 100 100 100
pages/profile 0 0 0 0
[username].tsx 0 0 0 0 24-117
pages/review 0 0 0 0
[lesson].tsx 0 0 0 0 22-50
---------------------------- --------- ---------- --------- --------- -------------------
ggwadera commented 3 years ago

LAST UPDATE: 2021-02-16

Test needs to be written for the files below to covered all the lines before we can add all relevant files for code coverage. Please create individual PRs to close each file and tag this issue and we will cross it off as we go.

File                        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------------------------|---------|----------|---------|---------|-------------------
All files                   |   87.43 |    86.77 |   83.99 |   87.07 |                   
 components/admin/alerts    |       0 |        0 |       0 |       0 |                   
  AdminNewAlert.tsx         |       0 |        0 |       0 |       0 | 20-73             
 components/admin/lessons   |       0 |        0 |       0 |       0 |                   
  AdminLessonChallenges.tsx |       0 |        0 |       0 |       0 | 15-169            
  AdminLessonInfo.tsx       |       0 |        0 |       0 |       0 | 33-164            
  AdminLessonsSideBar.tsx   |       0 |        0 |       0 |       0 | 11-38         
 graphql                    |       0 |        0 |       0 |       0 |                   
  resolvers.ts              |       0 |        0 |       0 |       0 |                   
  typeDefs.ts               |       0 |        0 |       0 |       0 |          
 graphql/queries            |      70 |      100 |     100 |      70 |         
  addAlert.ts               |       0 |      100 |     100 |       0 | 3                 
  createChallenge.ts        |       0 |      100 |     100 |       0 | 3                 
  createLesson.ts           |       0 |      100 |     100 |       0 | 3                 
  removeAlert.ts            |       0 |      100 |     100 |       0 | 3                 
  updateChallenge.ts        |       0 |      100 |     100 |       0 | 3                 
  updateLesson.ts           |       0 |      100 |     100 |       0 | 3                 
 helpers                    |   98.48 |    96.88 |   96.43 |   98.44 |                   
  withApollo.ts             |       0 |        0 |       0 |       0 | 4-13              
 pages                      |   82.99 |    71.43 |   75.76 |   82.52 |                   
  404.tsx                   |       0 |      100 |       0 |       0 | 4                 
  500.tsx                   |       0 |      100 |       0 |       0 | 5                 
  _app.tsx                  |       0 |        0 |       0 |       0 | 16-35             
  _error.tsx                |       0 |        0 |       0 |       0 | 12-68             
  book.tsx                  |       0 |      100 |       0 |       0 | 3-8               
 pages/admin                |   47.73 |        0 |   42.86 |   48.84 |                   
  alerts.tsx                |       0 |        0 |       0 |       0 | 18-65             
  lessons.tsx               |       0 |        0 |       0 |       0 | 8-12              
 pages/review               |       0 |        0 |       0 |       0 |                   
  [lesson].tsx              |       0 |        0 |       0 |       0 | 23-59             
songz commented 3 years ago

Update sprint devwong

89%

Screen Shot 2021-02-22 at 8 18 15 PM
ggwadera commented 3 years ago

UPDATE 2021-03-18

----------------------------|---------|----------|---------|---------|-------------------
File                        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------------------------|---------|----------|---------|---------|-------------------
All files                   |   99.61 |      100 |    98.7 |    99.6 |                   
 components                 |     100 |      100 |     100 |     100 |                   
  AdditionalResources.tsx   |     100 |      100 |     100 |     100 |                   
  Alert.tsx                 |     100 |      100 |     100 |     100 |                   
  AlertsDisplay.tsx         |     100 |      100 |     100 |     100 |                   
  AnnouncementCard.tsx      |     100 |      100 |     100 |     100 |                   
  AppNav.tsx                |     100 |      100 |     100 |     100 |                   
  Card.tsx                  |     100 |      100 |     100 |     100 |                   
  ChallengeMaterial.tsx     |     100 |      100 |     100 |     100 |                   
  ContributorCard.tsx       |     100 |      100 |     100 |     100 |                   
  DropdownMenu.tsx          |     100 |      100 |     100 |     100 |                   
  Error.tsx                 |     100 |      100 |     100 |     100 |                   
  FilterButtons.tsx         |     100 |      100 |     100 |     100 |                   
  Footer.tsx                |     100 |      100 |     100 |     100 |                   
  FormCard.tsx              |     100 |      100 |     100 |     100 |                   
  GiveStarCard.tsx          |     100 |      100 |     100 |     100 |                   
  Input.tsx                 |     100 |      100 |     100 |     100 |                   
  InputGroup.tsx            |     100 |      100 |     100 |     100 |                   
  LandingPage.tsx           |     100 |      100 |     100 |     100 |                   
  Layout.tsx                |     100 |      100 |     100 |     100 |                   
  LessonCard.tsx            |     100 |      100 |     100 |     100 |                   
  LessonTitleCard.tsx       |     100 |      100 |     100 |     100 |                   
  LoadingSpinner.tsx        |     100 |      100 |     100 |     100 |                   
  MdInput.tsx               |     100 |      100 |     100 |     100 |                   
  ModalCard.tsx             |     100 |      100 |     100 |     100 |                   
  NavLink.tsx               |     100 |      100 |     100 |     100 |                   
  ProfileImageInfo.tsx      |     100 |      100 |     100 |     100 |                   
  ProfileLessons.tsx        |     100 |      100 |     100 |     100 |                   
  ProfileSubmissions.tsx    |     100 |      100 |     100 |     100 |                   
  ProgressCard.tsx          |     100 |      100 |     100 |     100 |                   
  ReviewCard.tsx            |     100 |      100 |     100 |     100 |                   
  SubmissionCard.tsx        |     100 |      100 |     100 |     100 |                   
  Thanks.tsx                |     100 |      100 |     100 |     100 |                   
  UserInfoImage.tsx         |     100 |      100 |     100 |     100 |                   
 components/admin           |     100 |      100 |     100 |     100 |                   
  AdminLayout.tsx           |     100 |      100 |     100 |     100 |                   
 components/admin/alerts    |     100 |      100 |     100 |     100 |                   
  AdminNewAlert.tsx         |     100 |      100 |     100 |     100 |                   
 components/admin/lessons   |     100 |      100 |     100 |     100 |                   
  AdminLessonChallenges.tsx |     100 |      100 |     100 |     100 |                   
  AdminLessonInfo.tsx       |     100 |      100 |     100 |     100 |                   
  AdminLessonsSideBar.tsx   |     100 |      100 |     100 |     100 |                   
 components/admin/users     |     100 |      100 |     100 |     100 |                   
  AdminUsersSplitSearch.tsx |     100 |      100 |     100 |     100 |                   
  AdminUsersTable.tsx       |     100 |      100 |     100 |     100 |                   
 components/theme           |     100 |      100 |     100 |     100 |                   
  Button.tsx                |     100 |      100 |     100 |     100 |                   
  Text.tsx                  |     100 |      100 |     100 |     100 |                   
  colors.tsx                |     100 |      100 |     100 |     100 |                   
  sizes.tsx                 |     100 |      100 |     100 |     100 |                   
 containers                 |     100 |      100 |     100 |     100 |                   
  withQueryLoader.tsx       |     100 |      100 |     100 |     100 |                   
 graphql/queries            |     100 |      100 |     100 |     100 |                   
  acceptSubmission.ts       |     100 |      100 |     100 |     100 |                   
  addAlert.ts               |     100 |      100 |     100 |     100 |                   
  allUsers.ts               |     100 |      100 |     100 |     100 |                   
  changeAdminRights.ts      |     100 |      100 |     100 |     100 |                   
  createChallenge.ts        |     100 |      100 |     100 |     100 |                   
  createLesson.ts           |     100 |      100 |     100 |     100 |                   
  getApp.ts                 |     100 |      100 |     100 |     100 |                   
  getLessonMentors.ts       |     100 |      100 |     100 |     100 |                   
  getSubmissions.ts         |     100 |      100 |     100 |     100 |                   
  loginUser.ts              |     100 |      100 |     100 |     100 |                   
  logoutUser.ts             |     100 |      100 |     100 |     100 |                   
  rejectSubmission.ts       |     100 |      100 |     100 |     100 |                   
  removeAlert.ts            |     100 |      100 |     100 |     100 |                   
  resetPassword.ts          |     100 |      100 |     100 |     100 |                   
  setStar.ts                |     100 |      100 |     100 |     100 |                   
  signupUser.ts             |     100 |      100 |     100 |     100 |                   
  updateChallenge.ts        |     100 |      100 |     100 |     100 |                   
  updateLesson.ts           |     100 |      100 |     100 |     100 |                   
  updatePassword.ts         |     100 |      100 |     100 |     100 |                   
  userInfo.ts               |     100 |      100 |     100 |     100 |                   
 graphql/queryResolvers     |     100 |      100 |     100 |     100 |                   
  alerts.ts                 |     100 |      100 |     100 |     100 |                   
  allUsers.ts               |     100 |      100 |     100 |     100 |                   
  getLessonMentors.ts       |     100 |      100 |     100 |     100 |                   
  lessons.ts                |     100 |      100 |     100 |     100 |                   
  session.ts                |     100 |      100 |     100 |     100 |                   
 helpers                    |     100 |      100 |     100 |     100 |                   
  dbload.ts                 |     100 |      100 |     100 |     100 |                   
  encoding.ts               |     100 |      100 |     100 |     100 |                   
  findUser.ts               |     100 |      100 |     100 |     100 |                   
  formChange.ts             |     100 |      100 |     100 |     100 |                   
  formValidation.tsx        |     100 |      100 |     100 |     100 |                   
  hasPassedLesson.ts        |     100 |      100 |     100 |     100 |                   
  isAdmin.ts                |     100 |      100 |     100 |     100 |                   
  mail.ts                   |     100 |      100 |     100 |     100 |                   
  mattermost.ts             |     100 |      100 |     100 |     100 |                   
  noop.ts                   |     100 |      100 |     100 |     100 |                   
  splitWithSearchTerm.tsx   |     100 |      100 |     100 |     100 |                   
  updateSubmission.ts       |     100 |      100 |     100 |     100 |                   
  validateLessonId.ts       |     100 |      100 |     100 |     100 |                   
  withApollo.ts             |     100 |      100 |     100 |     100 |                   
 helpers/admin              |     100 |      100 |     100 |     100 |                   
  adminHelpers.ts           |     100 |      100 |     100 |     100 |                   
 helpers/controllers        |     100 |      100 |     100 |     100 |                   
  adminController.ts        |     100 |      100 |     100 |     100 |                   
  alertController.ts        |     100 |      100 |     100 |     100 |                   
  authController.ts         |     100 |      100 |     100 |     100 |                   
  challengesController.ts   |     100 |      100 |     100 |     100 |                   
  lessonsController.ts      |     100 |      100 |     100 |     100 |                   
  passwordController.ts     |     100 |      100 |     100 |     100 |                   
  starsController.ts        |     100 |      100 |     100 |     100 |                   
  submissionController.ts   |     100 |      100 |     100 |     100 |                   
  userInfoController.ts     |     100 |      100 |     100 |     100 |                   
 helpers/middleware         |     100 |      100 |     100 |     100 |                   
  logger.ts                 |     100 |      100 |     100 |     100 |                   
  user.ts                   |     100 |      100 |     100 |     100 |                   
 helpers/models             |     100 |      100 |     100 |     100 |                   
  Alert.ts                  |     100 |      100 |     100 |     100 |                   
  Challenge.ts              |     100 |      100 |     100 |     100 |                   
  Lesson.ts                 |     100 |      100 |     100 |     100 |                   
  Star.ts                   |     100 |      100 |     100 |     100 |                   
  Submission.ts             |     100 |      100 |     100 |     100 |                   
  User.ts                   |     100 |      100 |     100 |     100 |                   
  UserLesson.ts             |     100 |      100 |     100 |     100 |                   
 helpers/validation         |     100 |      100 |     100 |     100 |                   
  validateStudentId.ts      |     100 |      100 |     100 |     100 |                   
 pages                      |   95.83 |      100 |   87.88 |   95.71 |                   
  404.tsx                   |       0 |      100 |       0 |       0 | 4                 
  500.tsx                   |       0 |      100 |       0 |       0 | 5                 
  _app.tsx                  |     100 |      100 |     100 |     100 |                   
  _error.tsx                |     100 |      100 |     100 |     100 |                   
  book.tsx                  |       0 |      100 |       0 |       0 | 3-8               
  contributors.tsx          |     100 |      100 |     100 |     100 |                   
  curriculum.tsx            |     100 |      100 |     100 |     100 |                   
  forgotpassword.tsx        |     100 |      100 |     100 |     100 |                   
  index.tsx                 |     100 |      100 |     100 |     100 |                   
  login.tsx                 |     100 |      100 |     100 |     100 |                   
  signup.tsx                |     100 |      100 |     100 |     100 |                   
 pages/admin                |     100 |      100 |     100 |     100 |                   
  alerts.tsx                |     100 |      100 |     100 |     100 |                   
  lessons.tsx               |     100 |      100 |     100 |     100 |                   
  users.tsx                 |     100 |      100 |     100 |     100 |                   
 pages/api                  |     100 |      100 |     100 |     100 |                   
  graphql.ts                |     100 |      100 |     100 |     100 |                   
  lessons.ts                |     100 |      100 |     100 |     100 |                   
 pages/confirm              |     100 |      100 |     100 |     100 |                   
  [token].tsx               |     100 |      100 |     100 |     100 |                   
 pages/curriculum           |     100 |      100 |     100 |     100 |                   
  [lesson].tsx              |     100 |      100 |     100 |     100 |                   
 pages/profile              |     100 |      100 |     100 |     100 |                   
  [username].tsx            |     100 |      100 |     100 |     100 |                   
 pages/review               |     100 |      100 |     100 |     100 |                   
  [lesson].tsx              |     100 |      100 |     100 |     100 |                   
----------------------------|---------|----------|---------|---------|-------------------