Skip to content

Monerh A#12

Open
Miuroro wants to merge 2 commits intoHackYourAssignment:mainfrom
Miuroro:main
Open

Monerh A#12
Miuroro wants to merge 2 commits intoHackYourAssignment:mainfrom
Miuroro:main

Conversation

@Miuroro
Copy link
Copy Markdown

@Miuroro Miuroro commented Mar 18, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 18, 2026 20:31
@github-actions
Copy link
Copy Markdown

📝 HackYourFuture auto grade

Assignment Score: 100 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 50
🧪 The auto grade is experimental and still being improved

Test Details
Vitest unit test results:

✅ [10] Markdown file created
✅ [1] Content starts with # Cocktail Recipes
✅ [1] Content includes drink name as ## Margarita
✅ [1] Content includes medium drink image
✅ [1] Content includes category and alcoholic info
✅ [1] Content includes header ### Ingredients
✅ [1] Content includes ingredients list
✅ [1] Content includes header ### Instructions
✅ [1] Content includes instruction details
✅ [1] Content includes glass type
✅ [1] Calls console.error() if no cocktail name argument provided
✅ [1] Calls console.error() if cocktail not found
✅ [1] Calls console.error() if fetch was not OK
✅ should complete all CRUD operations successfully
✅ should verify updatePost uses PUT method with Authorization
✅ should verify deleteUser uses DELETE method with Authorization
✅ should verify deletePost uses DELETE method with Authorization
✅ should verify getMe fetches current user info with Authorization
✅ should handle errors in any CRUD operation
✅ should make GET request to /users/me with Authorization header
✅ should return user information with correct structure
✅ should throw error when response is not ok (404)
✅ should make GET request to /posts/me with Authorization header
✅ should return an array of posts
✅ should return empty array when no posts exist
✅ should make POST request to /users/register with correct data
✅ should return user data with correct structure
✅ should include Content-Type header
✅ should throw error when API returns error
✅ should make POST request to /users/login with correct data
✅ should return user data with token
✅ should throw error on invalid credentials
✅ should make POST request to /posts with correct data and Authorization header
✅ should return post data with correct structure
✅ should include Content-Type and Authorization headers
✅ should throw error when not authenticated

Total passed: 36
Total failed: 0

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the remaining Post Central CLI service functions and aligns tests/output artifacts with the completed behavior (notably, DELETE endpoints now parsing JSON responses), while also completing the cocktail markdown generator output for task 1.

Changes:

  • Implemented getMe, loginUser, createPost, getPosts, updatePost, deleteUser, and deletePost in post-cli services.
  • Updated CRUD tests’ fetch mocks to include json() for DELETE responses.
  • Added generated margarita.md output for the cocktail recipe task.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
task-2/post-cli/src/services.js Adds full CRUD+auth service implementations and switches BASE_URL between test vs non-test runtime.
task-2/post-cli/tests/test-crud.test.js Ensures mocked fetch responses include json() where the service now expects it.
task-1/cocktail.js Implements fetching, formatting, and writing markdown output for cocktail recipes.
task-1/output/margarita.md Adds the generated markdown output file for the margarita query.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@@ -1,5 +1,7 @@
// Change base URL for API requests to the local IP of the Post Central API server
const BASE_URL = 'http://localhost:3000';
// In the app, use the public API as the updated requairement. In tests, use localhost because tests check for localhost URLs.
@remarcmij remarcmij self-assigned this Mar 18, 2026
Copy link
Copy Markdown

@remarcmij remarcmij left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Miuroro, all looks good! Well done!

Comment on lines +2 to +4
const BASE_URL = process.env.VITEST
? 'http://localhost:3000'
: 'https://postcentral.hyf.dev';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I posted my message in Slack that you could use the public API as alternative I didn't take into account that the test requires the local API url. You solved it here by making the URL conditional on the presence of the VITEST environment variable. Very good if you did this completely yourself. Still good if AI helped you a bit.

@remarcmij remarcmij added the Reviewed This assignment has been reivewed by a mentor and a feedback has been provided label Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed This assignment has been reivewed by a mentor and a feedback has been provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants