File tree Expand file tree Collapse file tree 2 files changed +15
-10
lines changed
Expand file tree Collapse file tree 2 files changed +15
-10
lines changed Original file line number Diff line number Diff line change 11/** @jest -environment jsdom */
2- // import { countComments } from './comment_handler.js';
2+ import showsCount from './homepage' ;
3+
34describe ( 'Homepage items counter Tests' , ( ) => {
4- it ( 'Should test if showsCount is adding all shows to the home page' , ( ) => {
5- let counter = '' ;
6- const showInfo = ( ) => [ 'La Casa de Papel' , '1899' ] ;
7- const showsCount = ( ) => {
8- const show = showInfo ( ) ;
9- counter = `Top binge-worthy shows (${ show . length } )` ;
10- return counter ;
11- } ;
5+ document . body . innerHTML = `
6+ <li class="count-shows">Top binge-worthy shows</li>
7+ <main class="container">
8+ <article class="article" id="27436"></article>
9+ <article class="article" id="39749"></article>
10+ </main>
11+ ` ;
12+
13+ it ( 'Should test if showsCount() is adding all items counter to the home page' , ( ) => {
14+ const counter = document . querySelector ( '.count-shows' ) ;
1215 showsCount ( ) ;
13- expect ( counter ) . toBe ( 'Top binge-worthy shows (2)' ) ;
16+ expect ( counter . innerHTML ) . toBe ( 'Top binge-worthy shows (2)' ) ;
1417 } ) ;
1518
1619 it ( 'Count comments' , ( ) => {
Original file line number Diff line number Diff line change @@ -105,3 +105,5 @@ const displayShows = async () => {
105105} ;
106106
107107displayShows ( ) ;
108+
109+ export default showsCount ;
You can’t perform that action at this time.
0 commit comments