Skip to content

Mareh A.#19

Open
mareh-aboghanem wants to merge 1 commit intoHackYourAssignment:mainfrom
mareh-aboghanem:main
Open

Mareh A.#19
mareh-aboghanem wants to merge 1 commit intoHackYourAssignment:mainfrom
mareh-aboghanem:main

Conversation

@mareh-aboghanem
Copy link
Copy Markdown

No description provided.

@github-actions
Copy link
Copy Markdown

📝 HackYourFuture auto grade

Assignment Score: 80 / 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: 27
Total failed: 9

Copy link
Copy Markdown

@JalalHabeeb JalalHabeeb left a comment

Choose a reason for hiding this comment

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

The tests are also failing.

Comment thread task-1/cocktail.js
const alcoholic = `**Alcoholic:** ${drink.strAlcoholic}`;
const instructions = `### Instructions\n${drink.strInstructions}`;
const glass = `**Glass:** ${drink.strGlass}`;
let ingredients = "### Ingredients\n";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lists in markdown should have blank lines before and after, so another \n after ingredients

Comment thread task-1/cocktail.js
glass;
markdown.push(block);
}
const content = markdown.join("\n\n");
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 file should start with #Coctail Recipes at the first line
const content = "# Cocktail Recipes\n\n" + markdown.join("\n\n");

Comment thread task-1/cocktail.js
for (const drink of data.drinks) {
const name = `## ${drink.strDrink}`;
const image = `![${drink.strDrink}](${drink.strDrinkThumb}/medium)`;
const category = `**Category:** ${drink.strCategory}`;
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 colon should be outside the bold marker
const category = Category: ${drink.strCategory};
const alcoholic = Alcoholic: ${drink.strAlcoholic};
and there should be a blank line between them

Comment thread task-1/cocktail.js
const category = `**Category:** ${drink.strCategory}`;
const alcoholic = `**Alcoholic:** ${drink.strAlcoholic}`;
const instructions = `### Instructions\n${drink.strInstructions}`;
const glass = `**Glass:** ${drink.strGlass}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This should be serve in
const glass = Serve in: ${drink.strGlass};

Comment thread task-1/cocktail.js
throw error;
}
if (data.drinks === null) {
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.

Here should be error handling

if (data.drinks === null) {
    console.error("No cocktails found with that name.");
    return;                                                                                   
  }

Comment thread task-1/cocktail.js
// 4. Handle errors
console.error("Failed to get or to write cocktail data:", error.message);
}
//return data;
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 commented-out code should be deleted

@JalalHabeeb JalalHabeeb added the Reviewed This assignment has been reivewed by a mentor and a feedback has been provided label Mar 22, 2026
*/
const deletePost = async (id) => {
// TODO
const response = await fetch(`${BASE_URL}/posts/:id `, {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You should add the parameter as a variable to the url: ${BASE_URL}/posts/${id}

*/
const updatePost = async (id, text) => {
// TODO
const response = await fetch(`${BASE_URL}/posts/id`, {
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 id should be added as a variable : ${BASE_URL}/posts/${id}

const getPosts = async () => {
// TODO
const response = await fetch(`${BASE_URL}/posts/me`, {
method: "Get",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Get works, but the convention is GET

const getMe = async () => {
// TODO
const response = await fetch(`${BASE_URL}/users/me`, {
method: "Get",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Get works, but the convention is GET

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