Skip to content

Commit

Permalink
fix linters
Browse files Browse the repository at this point in the history
  • Loading branch information
aizjicod committed Jul 29, 2022
1 parent dcb404d commit fa7e017
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
32 changes: 16 additions & 16 deletions src/__test__/__mock__/api-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ export const mockApi = new Promise((resolve, reject) => {

export const mockLen = mockApi.then((data) => data.length);

export const updateUl = (data, ul) => {
data.forEach((child) => {
const commentLi = document.createElement('li');
commentLi.classList.add('comment-li')
export const updateUl = (data, ul) => {
data.forEach((child) => {
const commentLi = document.createElement('li');
commentLi.classList.add('comment-li');

const usernameP = document.createElement('p');
usernameP.textContent = `user: ${child.username}`;
const usernameP = document.createElement('p');
usernameP.textContent = `user: ${child.username}`;

const commentP = document.createElement('p');
commentP.textContent = `coment: ${child.comment}`;
const commentP = document.createElement('p');
commentP.textContent = `coment: ${child.comment}`;

const dateP = document.createElement('p');
dateP.classList.add('ul-date');
dateP.textContent = `${child.creation_date}`;
const dateP = document.createElement('p');
dateP.classList.add('ul-date');
dateP.textContent = `${child.creation_date}`;

commentLi.appendChild(usernameP);
commentLi.appendChild(commentP);
commentLi.appendChild(dateP);
ul.appendChild(commentLi);
commentLi.appendChild(usernameP);
commentLi.appendChild(commentP);
commentLi.appendChild(dateP);
ul.appendChild(commentLi);
});
}
};
16 changes: 8 additions & 8 deletions src/__test__/counter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ document.body.innerHTML = '<h3 class="modal-h3">coments (1) </h3><ul class="moda

const testData = [
{
username: 'karen',
comment: 'i love this pokemon',
creation_date: '2022-07-29'
}
]
username: 'karen',
comment: 'i love this pokemon',
creation_date: '2022-07-29',
},
];

describe('counter for api and pokemon card', () => {
test('verify number of items on board is equal api limit', () => {
expect(mockApi).toStrictEqual(mockLen);
});

test('verify number of comments', () => {
updateUl(testData, document.querySelector('.modal-ul'))
const li = document.querySelectorAll('.comment-li')
const arrLI = Array.from(li)
updateUl(testData, document.querySelector('.modal-ul'));
const li = document.querySelectorAll('.comment-li');
const arrLI = Array.from(li);
expect(arrLI.length).toBe(2);
});
});
2 changes: 1 addition & 1 deletion src/modules/commentPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const updateUl = (data, ul, h3) => {
if (data.length > 0) {
data.forEach((child) => {
const commentLi = document.createElement('li');
commentLi.classList.add('comment-li')
commentLi.classList.add('comment-li');

const usernameP = document.createElement('p');
usernameP.textContent = `user: ${child.username}`;
Expand Down

0 comments on commit fa7e017

Please sign in to comment.