Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gpont committed Aug 2, 2024
1 parent 9cc141c commit 8c512ee
Show file tree
Hide file tree
Showing 21 changed files with 186 additions and 171 deletions.
2 changes: 1 addition & 1 deletion coverage/badge-branches.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage/badge-functions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage/badge-lines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion coverage/badge-statements.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions coverage/coverage-summary.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{"total": {"lines":{"total":176,"covered":163,"skipped":0,"pct":92.61},"statements":{"total":188,"covered":175,"skipped":0,"pct":93.08},"functions":{"total":45,"covered":45,"skipped":0,"pct":100},"branches":{"total":57,"covered":43,"skipped":0,"pct":75.43},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/gpont/Documents/watch_together/src/controllers/bot.ts": {"lines":{"total":120,"covered":107,"skipped":0,"pct":89.16},"functions":{"total":29,"covered":29,"skipped":0,"pct":100},"statements":{"total":129,"covered":116,"skipped":0,"pct":89.92},"branches":{"total":51,"covered":39,"skipped":0,"pct":76.47}}
{"total": {"lines":{"total":176,"covered":164,"skipped":0,"pct":93.18},"statements":{"total":189,"covered":177,"skipped":0,"pct":93.65},"functions":{"total":46,"covered":46,"skipped":0,"pct":100},"branches":{"total":61,"covered":47,"skipped":0,"pct":77.04},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/gpont/Documents/watch_together/src/controllers/bot.ts": {"lines":{"total":120,"covered":108,"skipped":0,"pct":90},"functions":{"total":30,"covered":30,"skipped":0,"pct":100},"statements":{"total":130,"covered":118,"skipped":0,"pct":90.76},"branches":{"total":55,"covered":43,"skipped":0,"pct":78.18}}
,"/Users/gpont/Documents/watch_together/src/controllers/helpers.ts": {"lines":{"total":7,"covered":7,"skipped":0,"pct":100},"functions":{"total":3,"covered":3,"skipped":0,"pct":100},"statements":{"total":10,"covered":10,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/gpont/Documents/watch_together/src/dbController/database.ts": {"lines":{"total":8,"covered":8,"skipped":0,"pct":100},"functions":{"total":2,"covered":2,"skipped":0,"pct":100},"statements":{"total":8,"covered":8,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
,"/Users/gpont/Documents/watch_together/src/dbController/index.ts": {"lines":{"total":1,"covered":1,"skipped":0,"pct":100},"functions":{"total":0,"covered":0,"skipped":0,"pct":100},"statements":{"total":1,"covered":1,"skipped":0,"pct":100},"branches":{"total":0,"covered":0,"skipped":0,"pct":100}}
Expand Down
62 changes: 34 additions & 28 deletions coverage/lcov-report/controllers/bot.ts.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,30 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
<div class='clearfix'>

<div class='fl pad1y space-right2'>
<span class="strong">89.92% </span>
<span class="strong">90.76% </span>
<span class="quiet">Statements</span>
<span class='fraction'>116/129</span>
<span class='fraction'>118/130</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">76.47% </span>
<span class="strong">78.18% </span>
<span class="quiet">Branches</span>
<span class='fraction'>39/51</span>
<span class='fraction'>43/55</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="quiet">Functions</span>
<span class='fraction'>29/29</span>
<span class='fraction'>30/30</span>
</div>


<div class='fl pad1y space-right2'>
<span class="strong">89.16% </span>
<span class="strong">90% </span>
<span class="quiet">Lines</span>
<span class='fraction'>107/120</span>
<span class='fraction'>108/120</span>
</div>


Expand Down Expand Up @@ -317,7 +317,9 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
<a name='L252'></a><a href='#L252'>252</a>
<a name='L253'></a><a href='#L253'>253</a>
<a name='L254'></a><a href='#L254'>254</a>
<a name='L255'></a><a href='#L255'>255</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<a name='L255'></a><a href='#L255'>255</a>
<a name='L256'></a><a href='#L256'>256</a>
<a name='L257'></a><a href='#L257'>257</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
Expand Down Expand Up @@ -403,13 +405,13 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
Expand Down Expand Up @@ -534,18 +536,18 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -564,6 +566,8 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
Expand Down Expand Up @@ -656,9 +660,9 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
const chatId = msg.chat.id;
const userId = msg.from?.id;
&nbsp;
<span class="missing-if-branch" title="if path not taken" >I</span>if (!match) {
<span class="cstat-no" title="statement not covered" > bot.sendMessage(chatId, texts.no_movie_name);</span>
<span class="cstat-no" title="statement not covered" > return;</span>
if (!match<span class="branch-0 cbranch-no" title="branch not covered" >?.[1</span>]) {
bot.sendMessage(chatId, texts.no_movie_name);
return;
}
&nbsp;
if (!userId) {
Expand Down Expand Up @@ -787,9 +791,9 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
}
&nbsp;
const groupUser = await findGroupByCode(String(chatId));
if (!groupUser) {
bot.sendMessage(chatId, texts.not_in_group);
return;
<span class="missing-if-branch" title="if path not taken" >I</span>if (!groupUser) {
<span class="cstat-no" title="statement not covered" > bot.sendMessage(chatId, texts.not_in_group);</span>
<span class="cstat-no" title="statement not covered" > return;</span>
}
&nbsp;
const movieId = parseInt(match.slice(1).join(''), 10);
Expand All @@ -798,8 +802,8 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
if (movie) {
await markMovieAsVetoed(movieId);
bot.sendMessage(chatId, `${texts.vetoed} "${movie.name}"`);
} else <span class="missing-if-branch" title="else path not taken" >E</span>{
<span class="cstat-no" title="statement not covered" > bot.sendMessage(chatId, texts.movie_not_found);</span>
} else {
bot.sendMessage(chatId, texts.movie_not_found);
}
},
],
Expand All @@ -817,7 +821,9 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
const movies = await listMovies(groupUser.id);
&nbsp;
if (!!movies &amp;&amp; movies.length &gt; 0) {
const movie = movies[Math.floor(Math.random() * movies.length)];
const movie = movies.filter((movie) =&gt; !movie.is_vetoed)[
Math.floor(Math.random() * movies.length)
];
bot.sendMessage(chatId, getMovieDescription(movie), MSG_OPTIONS);
} else {
bot.sendMessage(chatId, texts.movie_list_empty);
Expand All @@ -832,7 +838,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-07-28T14:17:20.878Z
at 2024-08-02T06:19:45.240Z
</div>
<script src="../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion coverage/lcov-report/controllers/helpers.ts.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">controllers</a>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-07-28T14:17:20.878Z
at 2024-08-02T06:19:45.240Z
</div>
<script src="../prettify.js"></script>
<script>
Expand Down
Loading

0 comments on commit 8c512ee

Please sign in to comment.