Skip to content

Diana C.#3

Open
dianadenwik wants to merge 1 commit intoHackYourAssignment:mainfrom
dianadenwik:main
Open

Diana C.#3
dianadenwik wants to merge 1 commit intoHackYourAssignment:mainfrom
dianadenwik:main

Conversation

@dianadenwik
Copy link
Copy Markdown

No description provided.

@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

try {
// 1. Fetch data from the API at the given URL

const responce = await fetch(url);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

response not responce

throw new Error("not ok" + responce.status);
}
const data = await responce.json();
console.log(JSON.stringify(data.drinks[0], null, 2));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Debug console.logs should be deleted from the file when the development is finished.

}

function generateMarkdown(data) {
const drinks = data.drinks;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If drinks returned null , the function will still try to for...of over null, which will throw a TypeError.


function generateDrinkMarkdown(drink) {
return `

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These empty lines are visible in the markdown

throw new Error(
`Failed to delete post: HTTP ${response.status} ${response.statusText}`,
);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The function doesn't return the response body

throw new Error(
`Failed to delete post: HTTP ${response.status} ${response.statusText}`,
);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same as above

@@ -54,6 +54,18 @@ const getHello = async () => {
*/
const getMe = async () => {
// TODO
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

//TODO comments should be deleted after development finish


if (!response.ok) {
throw new Error(
`Failed to get hello: HTTP ${response.status} ${response.statusText}`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The error here is not about Hello, it's about me

});
if (!response.ok) {
throw new Error(
`Failed to delete post: HTTP ${response.status} ${response.statusText}`,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The error is about deleting a user, not a post

@JalalHabeeb JalalHabeeb 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.

2 participants