UNPKG

@git-temporal/git-temporal-react

Version:

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

148 lines (147 loc) 5.62 kB
<!doctype html> <html lang="en"> <head> <title>Code coverage report for app/actions/setDates.ts</title> <meta charset="utf-8" /> <link rel="stylesheet" href="../../prettify.css" /> <link rel="stylesheet" href="../../base.css" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type='text/css'> .coverage-summary .sorter { background-image: url(../../sort-arrow-sprite.png); } </style> </head> <body> <div class='wrapper'> <div class='pad1'> <h1> <a href="../../index.html">All files</a> / <a href="index.html">app/actions</a> setDates.ts </h1> <div class='clearfix'> </div> </div> <div class='status-line low'></div> <pre><table class="coverage"> <tr><td class="line-count quiet">1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35</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-neutral">&nbsp;</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> <span class="cline-any cline-yes">5x</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> <span class="cline-any cline-neutral">&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-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</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-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</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-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&nbsp;</span> <span class="cline-any cline-no">&nbsp;</span> <span class="cline-any cline-neutral">&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></td><td class="text"><pre class="prettyprint lang-js">import { fetchDiff } from 'app/actions/diff'; import { debug } from 'app/utilities/logger'; &nbsp; import { setStartDate, setEndDate } from 'app/actions'; import { dateFilteredCommits } from 'app/selectors/dates'; import { commits } from 'app/reducers/commits'; &nbsp; export const setDates = <span class="fstat-no" title="function not covered" >(_</span>startDate: number, _endDate: number | Date) =&gt; <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >(</span></span> dispatch, getState ) =&gt; { const [startDate, endDate] = <span class="cstat-no" title="statement not covered" > _startDate === _endDate</span> ? [_startDate, _endDate + 1] : !_endDate || _startDate &lt; _endDate ? [_startDate, _endDate] : [_endDate, _startDate]; &nbsp; const epochStartDate = <span class="cstat-no" title="statement not covered" >startDate &amp;&amp; Math.floor((startDate as number) / 1000);</span> const epochEndDate = <span class="cstat-no" title="statement not covered" >endDate &amp;&amp; Math.floor((endDate as number) / 1000);</span> &nbsp; <span class="cstat-no" title="statement not covered" > debug('actions: setDates', startDate, endDate, epochStartDate, epochEndDate);</span> &nbsp; <span class="cstat-no" title="statement not covered" > dispatch(setStartDate(epochStartDate));</span> <span class="cstat-no" title="statement not covered" > dispatch(setEndDate(epochEndDate));</span> &nbsp; const { commits, selectedPath } = <span class="cstat-no" title="statement not covered" >getState();</span> const leftCommit = <span class="cstat-no" title="statement not covered" > (startDate &amp;&amp; commits.find(<span class="fstat-no" title="function not covered" >c </span>=&gt; <span class="cstat-no" title="statement not covered" >c.authorDate &lt; epochStartDate)</span>) || null;</span> const rightCommit = <span class="cstat-no" title="statement not covered" > (endDate &amp;&amp; commits.find(<span class="fstat-no" title="function not covered" >c </span>=&gt; <span class="cstat-no" title="statement not covered" >c.authorDate &lt; epochEndDate)</span>) || null;</span> &nbsp; <span class="cstat-no" title="statement not covered" > dispatch(fetchDiff(selectedPath, leftCommit, rightCommit));</span> }; &nbsp;</pre></td></tr> </table></pre> <div class='push'></div><!-- for sticky footer --> </div><!-- /wrapper --> <div class='footer quiet pad2 space-top1 center small'> Code coverage generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Jan 20 2020 20:05:02 GMT-0800 (PST) </div> </div> <script src="../../prettify.js"></script> <script> window.onload = function () { if (typeof prettyPrint === 'function') { prettyPrint(); } }; </script> <script src="../../sorter.js"></script> </body> </html>