-
Notifications
You must be signed in to change notification settings - Fork 72
closes #389 - Create api/lessons page that returns object of lessons data #390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ject of lessons data
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/c0d3/c0d3-app/ggpmwfy6z |
Codecov Report
@@ Coverage Diff @@
## master #390 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 81 82 +1
Lines 1030 1037 +7
Branches 231 231
=========================================
+ Hits 1030 1037 +7
|
…ns function from graphql/queryResolvers folder upon import
export default async (_: LoggedRequest, res: NextApiResponse) => { | ||
try { | ||
const allLessons = await lessons() | ||
res.status(200) |
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.
by default, res.json
already has status 200, so unnecessary.
throw new Error('Error occured :(') | ||
}) | ||
await lessonsAPI(null, res) | ||
expect(res.json).toBeCalledWith('Error occured :(') |
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 and previous test could be combined
|
||
test('should respond with 200 status code when there is no error', async () => { | ||
await lessonsAPI(null, res) | ||
expect(res.status).toBeCalledWith(200) |
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.
no need
This page needs to be created, as the API is used in examples in the c0d3 curriculum
This PR will:
api/lessons
page that returns an object containing the same data the lessons API for version 1 of code returned.