Use async/await for tests.

This commit is contained in:
mike.rode
2019-02-24 03:00:44 -06:00
parent 0fe23657de
commit 003470c455
26 changed files with 110 additions and 141 deletions
+1 -1
View File
@@ -15,7 +15,7 @@
"host": "127.0.0.1",
"dialect": "postgres",
"operatorsAliases": false,
"logging": true
"logging": false
},
"production": {
"username": "postgres",
+14 -14
View File
@@ -20,9 +20,9 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">89.11% </span>
<span class="strong">87.62% </span>
<span class="quiet">Statements</span>
<span class='fraction'>180/202</span>
<span class='fraction'>177/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">88.68% </span>
<span class="strong">83.02% </span>
<span class="quiet">Functions</span>
<span class='fraction'>47/53</span>
<span class='fraction'>44/53</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">89.05% </span>
<span class="strong">87.56% </span>
<span class="quiet">Lines</span>
<span class='fraction'>179/201</span>
<span class='fraction'>176/201</span>
</div>
</div>
<p class="quiet">
@@ -89,15 +89,15 @@
<tr>
<td class="file high" data-value="recommend/server"><a href="recommend/server/index.html">recommend/server</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="18" class="abs high">18/18</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="18" class="abs high">15/18</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="18" class="abs high">18/18</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="6" class="abs medium">3/6</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="18" class="abs high">15/18</td>
</tr>
<tr>
@@ -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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
+14 -14
View File
@@ -20,9 +20,9 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="strong">83.33% </span>
<span class="quiet">Statements</span>
<span class='fraction'>18/18</span>
<span class='fraction'>15/18</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
@@ -30,14 +30,14 @@
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="strong">50% </span>
<span class="quiet">Functions</span>
<span class='fraction'>6/6</span>
<span class='fraction'>3/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="strong">83.33% </span>
<span class="quiet">Lines</span>
<span class='fraction'>18/18</span>
<span class='fraction'>15/18</span>
</div>
</div>
<p class="quiet">
@@ -63,15 +63,15 @@
</thead>
<tbody><tr>
<td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td>
<td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td>
<td data-value="100" class="pct high">100%</td>
<td data-value="18" class="abs high">18/18</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="18" class="abs high">15/18</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="0" class="abs high">0/0</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="6" class="abs high">6/6</td>
<td data-value="100" class="pct high">100%</td>
<td data-value="18" class="abs high">18/18</td>
<td data-value="50" class="pct medium">50%</td>
<td data-value="6" class="abs medium">3/6</td>
<td data-value="83.33" class="pct high">83.33%</td>
<td data-value="18" class="abs high">15/18</td>
</tr>
</tbody>
@@ -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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../prettify.js"></script>
+15 -15
View File
@@ -20,9 +20,9 @@
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="strong">83.33% </span>
<span class="quiet">Statements</span>
<span class='fraction'>18/18</span>
<span class='fraction'>15/18</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
@@ -30,14 +30,14 @@
<span class='fraction'>0/0</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="strong">50% </span>
<span class="quiet">Functions</span>
<span class='fraction'>6/6</span>
<span class='fraction'>3/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">100% </span>
<span class="strong">83.33% </span>
<span class="quiet">Lines</span>
<span class='fraction'>18/18</span>
<span class='fraction'>15/18</span>
</div>
</div>
<p class="quiet">
@@ -118,14 +118,14 @@
<span class="cline-any cline-yes">1x</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-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-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-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>
@@ -159,15 +159,15 @@ export default () =&gt; {
&nbsp;
const port = server.get('port');
&nbsp;
sequelize.sync().then(() =&gt; {
server.listen(port, () =&gt; {
console.log(`Express server listening on - http://${hostname}:${port}`);
sequelize.sync().then(<span class="fstat-no" title="function not covered" >()</span> =&gt; {
<span class="cstat-no" title="statement not covered" > server.listen(port, <span class="fstat-no" title="function not covered" >()</span> =&gt; {</span>
<span class="cstat-no" title="statement not covered" > console.log(`Express server listening on - http://${hostname}:${port}`);</span>
});
});
};
&nbsp;
process.on('unhandledRejection', (reason, p) =&gt; {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
process.on('unhandledRejection', <span class="fstat-no" title="function not covered" >(r</span>eason, p) =&gt; {
<span class="cstat-no" title="statement not covered" > console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);</span>
});
&nbsp;
return {create, start};
@@ -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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../prettify.js"></script>
@@ -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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 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">12x</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">3x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-yes">8x</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">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-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-yes">12x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">13x</span>
<span class="cline-any cline-yes">12x</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">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-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-yes">11x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">12x</span>
<span class="cline-any cline-yes">11x</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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -145,14 +145,14 @@
<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">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-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">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>
@@ -337,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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -149,8 +149,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-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>
@@ -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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
@@ -150,7 +150,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">4x</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-neutral">&nbsp;</span>
@@ -200,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">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-yes">3x</span>
<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>
@@ -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 02:09:19 GMT-0600 (Central Standard Time)
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Sun Feb 24 2019 03:00:29 GMT-0600 (Central Standard Time)
</div>
</div>
<script src="../../../../prettify.js"></script>
+20 -51
View File
@@ -5,59 +5,35 @@ import responses from './mocks/plexResponses';
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',
// });
// });
before(() => {
User.upsert(
{
firstName: 'Mike',
lastName: 'Rode',
email: 'michaelrode44@gmail.com',
},
{ where: { email: 'micahelrode44@gmail.com' } },
);
});
describe('GET /plex/import/sections', async () => {
it('should find and store sections in the database first', (done) => {
it('should find and store sections in the database first', async () => {
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);
const response = await chai.request(app).get('/plex/import/sections');
response.should.have.status(200);
const sections = await PlexSection.findAll();
sections.should.be.length(2);
});
});
describe('Get /plex/import/libraries', async () => {
it('should sections', (done) => {
it('should sections', async () => {
nock('https://plex.mjrflix.com')
.get(url => url.includes('/library/sections/3'))
.reply(200, responses.getLibraryDataBySectionRaw, {
@@ -73,16 +49,9 @@ describe('ImportData', () => {
.reply(200, responses.sectionsRaw, {
'Content-Type': 'text/json',
});
chai
.request(app)
.get('/plex/import/libraries')
.then((err, res) => {
PlexLibrary.findAll().then((media) => {
media.should.be.a('array');
// console.log('mikes-media', media);
done();
});
});
const response = await chai.request(app).get('/plex/import/libraries');
const media = await PlexLibrary.findAll();
media.should.be.length(56);
});
});
});