Import library test.

This commit is contained in:
mike.rode
2019-02-24 02:09:31 -06:00
parent d73afedec9
commit 0fe23657de
28 changed files with 223 additions and 195 deletions
+15 -15
View File
@@ -20,9 +20,9 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">84.16% </span>
<span class="strong">89.11% </span>
<span class="quiet">Statements</span>
<span class='fraction'>170/202</span>
<span class='fraction'>180/202</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">68.97% </span>
@@ -30,14 +30,14 @@
<span class='fraction'>20/29</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">77.36% </span>
<span class="strong">88.68% </span>
<span class="quiet">Functions</span>
<span class='fraction'>41/53</span>
<span class='fraction'>47/53</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">84.08% </span>
<span class="strong">89.05% </span>
<span class="quiet">Lines</span>
<span class='fraction'>169/201</span>
<span class='fraction'>179/201</span>
</div>
</div>
<p class="quiet">
@@ -140,16 +140,16 @@
</tr>
<tr>
<td class="file medium" data-value="recommend/server/services/plex"><a href="recommend/server/services/plex/index.html">recommend/server/services/plex</a></td>
<td data-value="75" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 75%;"></div><div class="cover-empty" style="width:25%;"></div></div></td>
<td data-value="75" class="pct medium">75%</td>
<td data-value="124" class="abs medium">93/124</td>
<td class="file high" data-value="recommend/server/services/plex"><a href="recommend/server/services/plex/index.html">recommend/server/services/plex</a></td>
<td data-value="83.06" class="pic high"><div class="chart"><div class="cover-fill" style="width: 83%;"></div><div class="cover-empty" style="width:17%;"></div></div></td>
<td data-value="83.06" class="pct high">83.06%</td>
<td data-value="124" class="abs high">103/124</td>
<td data-value="72.22" class="pct medium">72.22%</td>
<td data-value="18" class="abs medium">13/18</td>
<td data-value="68.42" class="pct medium">68.42%</td>
<td data-value="38" class="abs medium">26/38</td>
<td data-value="74.8" class="pct medium">74.8%</td>
<td data-value="123" class="abs medium">92/123</td>
<td data-value="84.21" class="pct high">84.21%</td>
<td data-value="38" class="abs high">32/38</td>
<td data-value="82.93" class="pct high">82.93%</td>
<td data-value="123" class="abs high">102/123</td>
</tr>
</tbody>
@@ -158,7 +158,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="prettify.js"></script>
+1 -1
View File
@@ -106,7 +106,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../prettify.js"></script>
+1 -1
View File
@@ -94,7 +94,7 @@ export default {server: _.merge(defaultConfig, envConfig), plex: plexConfig};
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../prettify.js"></script>
+1 -1
View File
@@ -73,7 +73,7 @@ export default plexConfig;
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../prettify.js"></script>
+1 -1
View File
@@ -70,7 +70,7 @@ export default testConfig;
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../prettify.js"></script>
+1 -1
View File
@@ -80,7 +80,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../prettify.js"></script>
+1 -1
View File
@@ -76,7 +76,7 @@ export default server.create(config);
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../prettify.js"></script>
@@ -80,7 +80,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
@@ -109,7 +109,7 @@ export default router;
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
+1 -1
View File
@@ -80,7 +80,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../prettify.js"></script>
+2 -2
View File
@@ -125,7 +125,7 @@
<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">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>
@@ -178,7 +178,7 @@ export default () =&gt; {
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../prettify.js"></script>
+1 -1
View File
@@ -119,7 +119,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
@@ -178,7 +178,7 @@ module.exports = db;
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
@@ -99,7 +99,7 @@
views: DataTypes.INTEGER,
rating_key: DataTypes.INTEGER,
metadata_path: DataTypes.STRING,
summary: DataTypes.STRING,
summary: DataTypes.TEXT,
rating: DataTypes.FLOAT,
year: DataTypes.INTEGER,
genre: DataTypes.STRING,
@@ -118,7 +118,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
@@ -97,7 +97,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
@@ -100,7 +100,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
+1 -1
View File
@@ -80,7 +80,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
@@ -79,7 +79,7 @@ export default router;
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
@@ -130,7 +130,7 @@ export default fetchToken;
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -103,21 +103,21 @@
<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">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">9x</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">10x</span>
<span class="cline-any cline-yes">10x</span>
<span class="cline-any cline-yes">10x</span>
<span class="cline-any cline-yes">10x</span>
<span class="cline-any cline-yes">10x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">10x</span>
<span class="cline-any cline-yes">13x</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>
@@ -125,13 +125,13 @@
<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">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">12x</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>
@@ -208,7 +208,7 @@ export default {formatResponse, buildUrl, request};
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -20,9 +20,9 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">48% </span>
<span class="strong">80% </span>
<span class="quiet">Statements</span>
<span class='fraction'>12/25</span>
<span class='fraction'>20/25</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
@@ -30,21 +30,21 @@
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">25% </span>
<span class="strong">66.67% </span>
<span class="quiet">Functions</span>
<span class='fraction'>3/12</span>
<span class='fraction'>8/12</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">48% </span>
<span class="strong">80% </span>
<span class="quiet">Lines</span>
<span class='fraction'>12/25</span>
<span class='fraction'>20/25</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
</div>
<div class='status-line low'></div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
@@ -141,8 +141,7 @@
<a name='L93'></a><a href='#L93'>93</a>
<a name='L94'></a><a href='#L94'>94</a>
<a name='L95'></a><a href='#L95'>95</a>
<a name='L96'></a><a href='#L96'>96</a>
<a name='L97'></a><a href='#L97'>97</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<a name='L96'></a><a href='#L96'>96</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>
@@ -168,6 +167,12 @@
<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>
<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-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>
<span class="cline-any cline-no">&nbsp;</span>
@@ -177,18 +182,11 @@
<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-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">2x</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">1x</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-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</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-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
@@ -215,8 +213,8 @@
<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-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">112x</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>
@@ -251,7 +249,6 @@ const createSections = sections =&gt; {
sections.forEach(async section =&gt; {
await models.PlexSection.upsert(
{
UserId: 1,
title: section.title,
type: section.type,
key: section.key,
@@ -265,10 +262,10 @@ const createSections = sections =&gt; {
});
};
&nbsp;
const importLibraries = <span class="fstat-no" title="function not covered" >as</span>ync () =&gt; {
const sections = <span class="cstat-no" title="statement not covered" >await plexApi.getSections();</span>
<span class="cstat-no" title="statement not covered" > sections.forEach(<span class="fstat-no" title="function not covered" >as</span>ync section =&gt; {</span>
<span class="cstat-no" title="statement not covered" > await importLibrary(section.key);</span>
const importLibraries = async () =&gt; {
const sections = await plexApi.getSections();
sections.forEach(async section =&gt; {
await importLibrary(section.key);
});
};
&nbsp;
@@ -279,12 +276,12 @@ const importMostWatched = <span class="fstat-no" title="function not covered" >a
});
};
&nbsp;
const importLibrary = <span class="fstat-no" title="function not covered" >as</span>ync sectionId =&gt; {
const libraryData = <span class="cstat-no" title="statement not covered" >await plexApi.getLibraryDataBySection({</span>
const importLibrary = async sectionId =&gt; {
const libraryData = await plexApi.getLibraryDataBySection({
sectionId,
});
<span class="cstat-no" title="statement not covered" > createLibrary(libraryData);</span>
<span class="cstat-no" title="statement not covered" > return libraryData;</span>
createLibrary(libraryData);
return libraryData;
};
&nbsp;
const updateLibrary = <span class="fstat-no" title="function not covered" >li</span>braryData =&gt; {
@@ -310,9 +307,9 @@ const updateLibrary = <span class="fstat-no" title="function not covered" >li</s
});
};
&nbsp;
const createLibrary = <span class="fstat-no" title="function not covered" >li</span>braryData =&gt; {
<span class="cstat-no" title="statement not covered" > libraryData.forEach(<span class="fstat-no" title="function not covered" >as</span>ync data =&gt; {</span>
<span class="cstat-no" title="statement not covered" > await models.PlexLibrary.upsert(</span>
const createLibrary = libraryData =&gt; {
libraryData.forEach(async data =&gt; {
await models.PlexLibrary.upsert(
{
title: data.title,
type: data.type,
@@ -340,7 +337,7 @@ export default {importSections, importLibraries, importMostWatched};
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -20,9 +20,9 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">75% </span>
<span class="strong">83.06% </span>
<span class="quiet">Statements</span>
<span class='fraction'>93/124</span>
<span class='fraction'>103/124</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">72.22% </span>
@@ -30,21 +30,21 @@
<span class='fraction'>13/18</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">68.42% </span>
<span class="strong">84.21% </span>
<span class="quiet">Functions</span>
<span class='fraction'>26/38</span>
<span class='fraction'>32/38</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">74.8% </span>
<span class="strong">82.93% </span>
<span class="quiet">Lines</span>
<span class='fraction'>92/123</span>
<span class='fraction'>102/123</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
</div>
<div class='status-line medium'></div>
<div class='status-line high'></div>
<div class="pad1">
<table class="coverage-summary">
<thead>
@@ -88,29 +88,29 @@
</tr>
<tr>
<td class="file low" data-value="importData.js"><a href="importData.js.html">importData.js</a></td>
<td data-value="48" class="pic low"><div class="chart"><div class="cover-fill" style="width: 48%;"></div><div class="cover-empty" style="width:52%;"></div></div></td>
<td data-value="48" class="pct low">48%</td>
<td data-value="25" class="abs low">12/25</td>
<td class="file high" data-value="importData.js"><a href="importData.js.html">importData.js</a></td>
<td data-value="80" class="pic high"><div class="chart"><div class="cover-fill" style="width: 80%;"></div><div class="cover-empty" style="width:20%;"></div></div></td>
<td data-value="80" class="pct high">80%</td>
<td data-value="25" class="abs high">20/25</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="25" class="pct low">25%</td>
<td data-value="12" class="abs low">3/12</td>
<td data-value="48" class="pct low">48%</td>
<td data-value="25" class="abs low">12/25</td>
<td data-value="66.67" class="pct medium">66.67%</td>
<td data-value="12" class="abs medium">8/12</td>
<td data-value="80" class="pct high">80%</td>
<td data-value="25" class="abs high">20/25</td>
</tr>
<tr>
<td class="file medium" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="76.67" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 76%;"></div><div class="cover-empty" style="width:24%;"></div></div></td>
<td data-value="76.67" class="pct medium">76.67%</td>
<td data-value="30" class="abs medium">23/30</td>
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="83.33" class="pic high"><div class="chart"><div class="cover-fill" style="width: 83%;"></div><div class="cover-empty" style="width:17%;"></div></div></td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="30" class="abs high">25/30</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="77.78" class="pct medium">77.78%</td>
<td data-value="9" class="abs medium">7/9</td>
<td data-value="76.67" class="pct medium">76.67%</td>
<td data-value="30" class="abs medium">23/30</td>
<td data-value="88.89" class="pct high">88.89%</td>
<td data-value="9" class="abs high">8/9</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="30" class="abs high">25/30</td>
</tr>
<tr>
@@ -132,7 +132,7 @@
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -20,9 +20,9 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">76.67% </span>
<span class="strong">83.33% </span>
<span class="quiet">Statements</span>
<span class='fraction'>23/30</span>
<span class='fraction'>25/30</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
@@ -30,21 +30,21 @@
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">77.78% </span>
<span class="strong">88.89% </span>
<span class="quiet">Functions</span>
<span class='fraction'>7/9</span>
<span class='fraction'>8/9</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">76.67% </span>
<span class="strong">83.33% </span>
<span class="quiet">Lines</span>
<span class='fraction'>23/30</span>
<span class='fraction'>25/30</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
</div>
<div class='status-line medium'></div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
@@ -154,8 +154,8 @@
<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-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">1x</span>
@@ -217,9 +217,9 @@ const importSections = async (req, res) =&gt; {
res.json(sections);
};
&nbsp;
const importLibraries = <span class="fstat-no" title="function not covered" >as</span>ync (req, res) =&gt; {
const libraries = <span class="cstat-no" title="statement not covered" >await importData.importLibraries();</span>
<span class="cstat-no" title="statement not covered" > res.json(libraries);</span>
const importLibraries = async (req, res) =&gt; {
const libraries = await importData.importLibraries();
res.json(libraries);
};
&nbsp;
const importMostWatched = <span class="fstat-no" title="function not covered" >as</span>ync (req, res) =&gt; {
@@ -244,7 +244,7 @@ export default {
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -150,6 +150,32 @@
<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">4x</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-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">2x</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-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">1x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
@@ -161,28 +187,9 @@
<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-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-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">1x</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-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">2x</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-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1x</span>
@@ -193,10 +200,10 @@
<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">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">2x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</span>
<span class="cline-any cline-yes">4x</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>
@@ -204,14 +211,7 @@
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-yes">3x</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">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">3x</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>
@@ -322,7 +322,7 @@ export default {
</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 Sun Feb 24 2019 01:38:48 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 02:09:19 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -24,7 +24,7 @@ module.exports = {
type: Sequelize.STRING,
},
summary: {
type: Sequelize.STRING,
type: Sequelize.TEXT,
},
rating: {
type: Sequelize.FLOAT,
+1 -1
View File
@@ -7,7 +7,7 @@ module.exports = (sequelize, DataTypes) => {
views: DataTypes.INTEGER,
rating_key: DataTypes.INTEGER,
metadata_path: DataTypes.STRING,
summary: DataTypes.STRING,
summary: DataTypes.TEXT,
rating: DataTypes.FLOAT,
year: DataTypes.INTEGER,
genre: DataTypes.STRING,
-1
View File
@@ -11,7 +11,6 @@ const createSections = sections => {
sections.forEach(async section => {
await models.PlexSection.upsert(
{
UserId: 1,
title: section.title,
type: section.type,
key: section.key,
+68 -36
View File
@@ -2,55 +2,87 @@ import chai from 'chai';
import nock from 'nock';
import app from '../../../../index';
import responses from './mocks/plexResponses';
import { PlexSection, User } from '../../../../server/models';
import { PlexSection, User, PlexLibrary } from '../../../../server/models';
import truncate from '../../../truncate';
// before(() => truncate('PlexSection'));
before(() => truncate('PlexSection'));
describe('ImportData', () => {
beforeEach(() => {
User.create({
firstName: 'Mike',
lastName: 'Rode',
email: 'michaelrode44@gmail.com',
// beforeEach(() => {
// User.create({
// firstName: 'Mike',
// lastName: 'Rode',
// email: 'michaelrode44@gmail.com',
// });
// });
describe('GET /plex/import/sections', async () => {
it('should find and store sections in the database first', (done) => {
nock('https://plex.mjrflix.com')
.get('/library/sections?X-Plex-Token=testPlexApiToken')
.reply(200, responses.sectionsRaw, {
'Content-Type': 'text/json',
});
chai
.request(app)
.get('/plex/import/sections')
.then((err, res) => {
PlexSection.findAll().then((sections) => {
sections.should.be.a('array');
sections.should.have.length(2);
});
done();
})
.catch(done);
});
it('should find and store sections in the database second', (done) => {
nock('https://plex.mjrflix.com')
.get('/library/sections?X-Plex-Token=testPlexApiToken')
.reply(200, responses.sectionsRaw, {
'Content-Type': 'text/json',
});
chai
.request(app)
.get('/plex/import/sections')
.then((err, res) => {
PlexSection.findAll().then((sections) => {
sections.should.be.a('array');
sections.should.have.length(2);
});
done();
})
.catch(done);
});
});
describe('GET /plex/import/sections', async () => {
it('should find and store sections in the database', (done) => {
describe('Get /plex/import/libraries', async () => {
it('should sections', (done) => {
nock('https://plex.mjrflix.com')
.get(url => url.includes('/library/sections/3'))
.reply(200, responses.getLibraryDataBySectionRaw, {
'Content-Type': 'text/json',
});
nock('https://plex.mjrflix.com')
.get(url => url.includes('/library/sections/2'))
.reply(200, responses.getLibraryDataBySectionRaw, {
'Content-Type': 'text/json',
});
nock('https://plex.mjrflix.com')
.get('/library/sections?X-Plex-Token=testPlexApiToken')
.reply(200, responses.sectionsRaw, {
'Content-Type': 'text/json',
});
chai
.request(app)
.get('/plex/import/sections')
.then(() => PlexSection.findAll().then((sections) => {
console.log('Sections 1', sections);
sections.should.be.a('array');
sections.should.have.length(2);
done();
}))
.catch(done);
});
it('should find and store sections in the database', (done) => {
nock('https://plex.mjrflix.com')
.get('/library/sections?X-Plex-Token=testPlexApiToken')
.reply(200, responses.sectionsRaw, {
'Content-Type': 'text/json',
.get('/plex/import/libraries')
.then((err, res) => {
PlexLibrary.findAll().then((media) => {
media.should.be.a('array');
// console.log('mikes-media', media);
done();
});
});
chai
.request(app)
.get('/plex/import/sections')
.then(() => PlexSection.findAll().then((sections) => {
console.log('Sections 2', sections);
sections.should.be.a('array');
sections.should.have.length(2);
done();
}))
.catch(done);
});
});
});