Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #50 from githubtraining/validations
Browse files Browse the repository at this point in the history
added validations to every step
  • Loading branch information
hectorsector authored Aug 20, 2019
2 parents cb8f2a9 + 5745f1d commit 9d0e527
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 1 deletion.
55 changes: 55 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ steps:
- type: getPullRequest
pullRequest: Changes
action_id: metaPR2
- type: getFileContents
action_id: fileContents
filename: 'src/App.jsx'
- type: gate
left: '/^\s*<\s*h3\s*className\s*=\s*"\s*Box-title\s*d-flex\s*flex-justify-center\s*"\s*>\s*GradeBook\s*<\s*\/\s*h3\s*>/gm'
operator: test
right: '%actions.fileContents%'
else:
- type: respond
with: bad-header.md
issue: Changes
- type: respond
with: 02-props.md
issue: Changes
Expand All @@ -74,6 +85,17 @@ steps:
- type: getPullRequest
pullRequest: Changes
action_id: metaPR2
- type: getFileContents
action_id: fileContents
filename: 'src/App.jsx'
- type: gate
left: '/^\s*import\s*List\s*from\s*"\s*\.\/List\s*"\s*;\s*/gm'
operator: test
right: '%actions.fileContents%'
else:
- type: respond
with: bad-import.md
issue: Changes
- type: createPullRequestComment
body: uncomment-assignments-activity.md
file: src/App.jsx
Expand Down Expand Up @@ -121,6 +143,17 @@ steps:
- type: getPullRequest
pullRequest: Changes
action_id: metaPR2
- type: getFileContents
action_id: fileContents
filename: 'src/List.jsx'
- type: gate
left: '/>\s*{\s*this\.props\.title\s*}\s*<\s*/gm'
operator: test
right: '%actions.fileContents%'
else:
- type: respond
with: bad-prop.md
issue: Changes
- type: respond
with: 03-state.md
issue: Changes
Expand All @@ -142,6 +175,17 @@ steps:
- type: getPullRequest
pullRequest: Changes
action_id: metaPR2
- type: getFileContents
action_id: fileContents
filename: 'src/App.jsx'
- type: gate
left: '/\s*students\s*:\s*\[\s*\]\s*,\s*/gm'
operator: test
right: '%actions.fileContents%'
else:
- type: respond
with: bad-state.md
issue: Changes
- type: createPullRequestComment
body: explaining-this-state-activity.md
file: src/App.jsx
Expand Down Expand Up @@ -231,6 +275,17 @@ steps:
- type: getPullRequest
pullRequest: Changes
action_id: metaPR2
- type: getFileContents
action_id: fileContents
filename: 'src/App.jsx'
- type: gate
left: '/\s*placeholder\s*=\s*"Add\sStudent\.\.\."\s*\n\s*currList\s*=\s*{\s*this\.state\.students\s*}\n\s*addFunction\s*=\s*{\s*this\.addStudent\s*}\s*\n/gm'
operator: test
right: '%actions.fileContents%'
else:
- type: respond
with: bad-replace.md
issue: Changes
- type: createPullRequestComment
body: uncomment-grades-activity.md
file: src/App.jsx
Expand Down
2 changes: 1 addition & 1 deletion responses/bad-function.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Looks you did not create an `addStudent` function with the parameter: `studentName`.
Looks like you did not create an `addStudent` function with the parameter: `studentName`.

Try again!
3 changes: 3 additions & 0 deletions responses/bad-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Looks like you did not correctly add an `h3` component in the right place in `src/App.jsx`.

Try again!
3 changes: 3 additions & 0 deletions responses/bad-import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Looks like you did not import the `List` component into `App`.

Try again!
3 changes: 3 additions & 0 deletions responses/bad-prop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Looks like you did not replace the title with a prop in the correct place in `src/List.jsx`

Try again!
3 changes: 3 additions & 0 deletions responses/bad-replace.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Looks like you did not replace the props for student rendering.

Try again!
3 changes: 3 additions & 0 deletions responses/bad-state.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Looks like you did not add a `students` state variable.

Try again!

0 comments on commit 9d0e527

Please sign in to comment.