text: /**
   * @jest-environment jsdom
   */
  
  const { expect, test, describe } = require('@jest/globals');
  const LocalStorage = require('./store.js');
  
  const localStorage = new LocalStorage();
  
  const updateArray = (tasksArray, tasksList) => {
    const items = [...tasksList.children];
  
    tasksArray = [];
  
    items.forEach((item, index) => {
      const newTask = {
        description: item.lastChild.textContent,
        completed: item.firstChild.checked,
        index: index + 1,
      };
      tasksArray.push(newTask);
    });
    localStorage.setDataLocalStorage(tasksArray);
  };
  
  describe('edit methods tests', () => {
    document.body.innerHTML = '<ul class="tasks-list">'
    + '<li data-id = "1"><input type="checkbox"><p>success professionally</p></li>'
    + '</ul>';
  
    const tasksList = document.querySelector('.tasks-list');
  
    const tasksArray = [
      {
        description: 'success professionally',
        completed: false,
        index: 1,
      },
    ];
  
    const editTasks = (str) => {
      const task = document.querySelector('li[data-id="1"]');
      task.lastChild.textContent = str;
      updateArray(tasksArray, tasksList);
      return task;
    };
  
    test('edit dom text', () => {
      expect(editTasks('take a break').innerHTML).toBe('<input type="checkbox"><p>take a break</p>');
    });
  
    test('get edited description from local storage', () => {
      expect(localStorage.getDataLocalStorage()[0].description).toBe('take a break');
    });
  });