title: How to test (unit test) arrow functions in JS via Jasmine?
body: <p>I've done a small project "Notes" and now trying to test it using Jasmine. But since it's my first script using module style and imitation of the private functions, I can't understand how can I test the business logic of my script, since Jasmine doesn't see my arrow functions at all. Please help me to start my tests.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// eslint-disable-next-line func-names
  const NotesList = ((function () {
    const NOTE_TITLE = 'notesList';
  
    const initNotesList = () =&gt; {
      if (localStorage.getItem(NOTE_TITLE)) {
        return JSON.parse(localStorage.getItem(NOTE_TITLE));
      }
  
      return [];
    };
  
    let notesList = initNotesList();
  
    const saveData = (data) =&gt; {
      notesList = [...data];
      localStorage.setItem(NOTE_TITLE, JSON.stringify(notesList));
    };
  
    const addNote = (note) =&gt; {
      if (notesList.includes(note)) {
        return {
          done: false,
          error: 'The note is in the notes list already',
        };
      }
  
      saveData([...notesList, note]);
      return {
        done: true,
      };
    };
  
    const removeNote = (note) =&gt; {
      const filteredNotesList = notesList.filter((item) =&gt; item !== note);
      if (filteredNotesList.length === notesList.length) {
        return {
          done: false,
          error: 'Note doesn\'t exist',
        };
      }
  
      saveData(filteredNotesList);
      return { done: true };
    };
  
    return {
      getNotesList() {
        return notesList;
      },
      addItem(item) {
        return addNote(item);
      },
      removeItem(item) {
        return removeNote(item);
      },
    };
  })());
  
  const STYLES = {
    show: 'd-block',
  };
  
  const UI = {
    noteValue: document.querySelector('#note-value'),
    addNote: document.querySelector('#add-note'),
    removeNote: document.querySelector('#remove-note'),
    errorMessage: document.querySelector('#error-message'),
    list: document.querySelector('#list'),
  
    renderNotesList() {
      this.clearNotesList();
      NotesList.getNotesList().forEach((item) =&gt; {
        const li = document.createElement('li');
        li.innerText = item;
        this.list.append(li);
      });
    },
  
    clearNotesList() {
      this.list.innerText = '';
    },
  
    handleNotesListResponse(result) {
      if (result.done) {
        this.noteValue.value = '';
        this.errorMessage.classList.remove(STYLES.show);
        this.renderNotesList();
      } else {
        this.errorMessage.innerText = result.error;
        this.errorMessage.classList.add(STYLES.show);
      }
    },
  };
  
  UI.addNote.addEventListener('click', (event) =&gt; {
    event.preventDefault();
    const result = NotesList.addItem(UI.noteValue.value);
    UI.handleNotesListResponse(result);
  });
  
  UI.removeNote.addEventListener('click', (event) =&gt; {
    event.preventDefault();
    const result = NotesList.removeItem(UI.noteValue.value);
    UI.handleNotesListResponse(result);
  });
  
  UI.renderNotesList();</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body{font-family:"Roboto Condensed",sans-serif;font-size:16px}header{background:none}.nav-link{font-size:20px}.container{max-width:1200px;background-image:url(../images/blue-snow.png)}.container-header{max-width:1200px}.container-footer{max-width:1200px}footer li{display:inline;padding-right:5px;padding-bottom:5px}ul li a :hover{transform:rotate(1turn);transition:0.5s ease-in}html{scroll-behavior:smooth}</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport"
          content="width=device-width, initial-scale=1, shrink-to-fit=no"&gt;
    &lt;link rel="stylesheet"
          href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
          integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
          crossorigin="anonymous"&gt;
    &lt;link
        href="https://fonts.googleapis.com/css?family=Roboto+Condensed&amp;display=swap"
        rel="stylesheet"&gt;
    &lt;link rel="stylesheet" type="text/css" href="../dist/style.css"/&gt;
    &lt;title&gt;Homework 1&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div class="container-header mx-auto"&gt;
    &lt;header&gt;
      &lt;nav class="navbar navbar-expand-lg navbar navbar-light bg-light"&gt;
        &lt;a class="navbar-brand pr-4"
           href="https://github.com/TrekFuel/home_tasks_FE-2" target="_blank"&gt;&lt;img
            src="../images/github-logo-header-image.png"
            alt="GitHub" title="GitHub"
            width="40" height="40"/&gt;&lt;/a&gt;
        &lt;button class="navbar-toggler" type="button" data-toggle="collapse"
                data-target="#navbarSupportedContent"
                aria-controls="navbarSupportedContent" aria-expanded="false"
                aria-label="Toggle navigation"&gt;
          &lt;span class="navbar-toggler-icon"&gt;&lt;/span&gt;
        &lt;/button&gt;
        &lt;div class="collapse navbar-collapse" id="navbarSupportedContent"&gt;
          &lt;ul class="navbar-nav mr-auto"&gt;
            &lt;li class="nav-item active pr-5"&gt;
              &lt;a class="nav-link" href="homework-3.html"&gt;Home Tasks (to the
                previous page)&lt;span
                    class="sr-only"&gt;&lt;/span&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li class="nav-item active"&gt;
              &lt;a class="nav-link" href="#2"&gt;Contacts&lt;span
                  class="sr-only"&gt;&lt;/span&gt;&lt;/a&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
      &lt;/nav&gt;
    &lt;/header&gt;
  &lt;/div&gt;
  &lt;div class="container mx-auto d-flex"&gt;
    &lt;main&gt;
      &lt;div class="row mt-5 mb-5 ml-3 mr-3"&gt;
        &lt;div class="col"&gt;
          &lt;h1 class="text-center mb-4"&gt;Notes&lt;/h1&gt;
          &lt;div class="input-group input-group-lg mx-auto mt-5 mb-5"&gt;
            &lt;input type="text" class="form-control"
                   id="note-value"
                   name="note-value"
                   value=""
                   placeholder="Note"
                   aria-label="Note"
                   aria-describedby="button-addon4 inputGroup-sizing-lg"&gt;
            &lt;div class="input-group-append" id="button-addon4"&gt;
              &lt;button class="btn btn-outline-secondary" id="add-note"
                      type="button"&gt;Add note
              &lt;/button&gt;
              &lt;button class="btn btn-outline-secondary" id="remove-note"
                      type="button"&gt;Remove
                note
              &lt;/button&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class="alert alert-danger d-none" id="error-message"
               role="alert"&gt;&lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="row mt-3 mb-3"&gt;
        &lt;div class="col"&gt;
          &lt;ul id="list"&gt;&lt;/ul&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/main&gt;
  &lt;/div&gt;
  &lt;div class="container-footer mx-auto"&gt;
    &lt;footer&gt;
      &lt;a name="2"&gt;&lt;/a&gt;
      &lt;div class="card text-center"&gt;
        &lt;div class="card-header"&gt;
          &lt;a name="7"&gt;&lt;/a&gt;
          &lt;h3&gt;Contacts&lt;/h3&gt;
        &lt;/div&gt;
        &lt;div class="card-footer text-center"&gt;
          &lt;ul class="list-unstyled p-2"&gt;
            &lt;li&gt;
              &lt;a href="https://vk.com/bolotinnikita" target="_blank"&gt;
                &lt;img src="../images/vk-logo.png"
                     width="30"
                     height="30"
                     alt="ВК"
                     title="ВК"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="https://twitter.com/bolotinnick" target="_blank"&gt;
                &lt;img src="../images/twitter-logo.png"
                     width="30"
                     height="30"
                     alt="Twitter"
                     title="Twitter"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="https://www.linkedin.com/in/bolotinnick/" target="_blank"&gt;
                &lt;img src="../images/linkedin-logo.png"
                     width="30"
                     height="30"
                     alt="LinkedIn"
                     title="LinkedIn"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="https://github.com/TrekFuel" target="_blank"&gt;
                &lt;img src="../images/github-logo.png"
                     width="30"
                     height="30"
                     alt="GitHub"
                     title="GitHub"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="https://www.instagram.com/bolotinnick/" target="_blank"&gt;
                &lt;img src="../images/instagram-logo.png"
                     width="30"
                     height="30"
                     alt="Instagram"
                     title="Instagram"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="mailto:ridge96@yandex.ru?subject=website"&gt;
                &lt;img src="../images/email-logo.png"
                     width="30"
                     height="30"
                     alt="Email"
                     title="Email"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="https://t.me/bolotinnick" target="_blank"&gt;
                &lt;img src="../images/telegram-logo.png"
                     width="30"
                     height="30"
                     alt="Telegram"
                     title="Telegram"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="skype:nick-spinner96?add"&gt;
                &lt;img src="../images/skype-logo.png"
                     width="30"
                     height="30"
                     alt="Skype"
                     title="Skype"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="viber://chat?number=+375291328633"&gt;
                &lt;img src="../images/viber-logo.png"
                     width="30"
                     height="30"
                     alt="Viber"
                     title="Viber"/&gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li&gt;
              &lt;a href="https://wa.me/375291328633" target="_blank"&gt;
                &lt;img src="../images/whatsapp-logo.png"
                     width="30"
                     height="30"
                     alt="WhatsApp"
                     title="WhatsApp"/&gt;&lt;/a&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
          &lt;div class="btn btn-info mb-2"&gt;Bolotin Nikita &amp;copy;, 2019-2020 &lt;br&gt;
            FE-2
            Courses
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="text-left m-2"&gt;
          &lt;a href="#top" class="btn btn-primary" id="btn"&gt;To the top
            &amp;uarr;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/footer&gt;
  &lt;/div&gt;
  &lt;script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
          integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
          crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script
      src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
      integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
      crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script
      src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
      integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
      crossorigin="anonymous"&gt;&lt;/script&gt;
  &lt;script src="../js/notes(hw-3).js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <pre><code>// eslint-disable-next-line no-undef
  describe('notes(hw-3).js -&gt; initNotesList', () =&gt; {
    // eslint-disable-next-line no-undef
    it('should return Object from the LocalStorage in case there are items'
      + ' there, otherwise should return an empty array', () =&gt; {
  
    });
  });
  </code></pre>