ClintonYounge / To-Do-List-Project

To-Do List Project is a project where I set up a basic to-do list web application utilizing webpack configurations and ES6 recommended practices to optimize the projects interactivity. Along with testing.
https://clintonyounge.github.io/To-Do-List-Project/dist
3 stars 0 forks source link

testing To Do list pull request #10

Closed theresetuyi closed 1 year ago

theresetuyi commented 1 year ago

Testing to-do list

-Write unit tests for a JavaScript app

ClintonYounge commented 1 year ago

It throws that error because you didn't run the prerequisites that were in the readme file

On Thu, Mar 9, 2023, 3:26 PM Kalolo Chola Lemba @.***> wrote:

@.**** requested changes on this pull request.

Hi @TEAM 👋 Good job so far working on the project requirements! There are some issues that you still need to work on to go to the next project but you are almost there!

To Highlight 🎉 No linter errors. ✔️ GitHub flow is followed. ✔️

Required Changes ♻️ Check the comments under the review in the inline comments.

Optional suggestions Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

You can also consider: N/A

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear. Please, remember to tag me in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.

As described in the Code reviews limits policy https://microverse.zendesk.com/hc/en-us/articles/1500004088561 you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form https://airtable.com/shrQAqnBwek5a0O0s.

In test/task.test.js https://github.com/ClintonYounge/To-Do-List-Project/pull/10#discussion_r1131493659 :

+/*

    • @jest-environment jsdom
  • */
  • +import { addTask, deleteTask, taskList } from '../src/module/task.js';

  • +// Tests for addTask function +describe('addTask function', () => {

  • test('should add a new task to the task list', () => {
  • addTask('Task 2');
  • expect(taskList.children.length).toBe(2);
  • expect(taskList.children[1].querySelector('.task-desc').textContent).toBe('Task 2');
  • });
  • test('should not add a task if the description is empty', () => {
  • addTask('');
  • expect(taskList.children.length).toBe(2);
  • }); +}); +// Tests for deleteTask function +describe('deleteTask function', () => {
  • test('should delete a task from the task list', () => {
  • const deleteButton = taskList.children[0].querySelector('.delete-task-button');
  • const taskItem = deleteButton.parentElement;
  • deleteTask(taskItem);
  • expect(taskList.children.length).toBe(1);
  • });
  • test('should not delete a task if the index is out of range', () => {
  • deleteTask(taskList.children.length);
  • expect(taskList.children.length).toBe(1);
  • }); +});

While you did a good job working on the project requirements , when I run your tests I notice its throwing this error [image: Screenshot 2023-03-09 at 9 18 55 PM] https://user-images.githubusercontent.com/79506105/224132080-03207631-b07c-49a3-a9ff-cd6b23019118.png

It would be nice if you corrected this error for your tests to pass .

— Reply to this email directly, view it on GitHub https://github.com/ClintonYounge/To-Do-List-Project/pull/10#pullrequestreview-1333600681, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4JSSCD6WA5B3WRKLFI5GVLW3IVHXANCNFSM6AAAAAAVU2MNWA . You are receiving this because you were mentioned.Message ID: @.***>

ClintonYounge commented 1 year ago

@DuaneDave Thank you.