mirror of
https://github.com/musix-org/musix-oss
synced 2026-01-07 22:16:55 +00:00
Updated
This commit is contained in:
6
node_modules/@firebase/installations/.eslintrc.json
generated
vendored
Normal file
6
node_modules/@firebase/installations/.eslintrc.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "../../config/.eslintrc.json",
|
||||
"parserOptions": {
|
||||
"project": "tsconfig.json"
|
||||
}
|
||||
}
|
||||
291
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/common.test.ts.html
generated
vendored
Normal file
291
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/common.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,291 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api/common.test.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">api</a> common.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>35/35</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>7/7</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>31/31</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import '../testing/setup';
|
||||
import { retryIfServerError } from './common';
|
||||
|
||||
describe('common', () => {
|
||||
describe('retryIfServerError', () => {
|
||||
let fetchStub: SinonStub<[], Promise<Response>>;
|
||||
|
||||
beforeEach(() => {
|
||||
fetchStub = stub();
|
||||
});
|
||||
|
||||
it('retries once if the server returns a 5xx error', async () => {
|
||||
const expectedResponse = new Response();
|
||||
fetchStub.onCall(0).resolves(new Response(null, { status: 500 }));
|
||||
fetchStub.onCall(1).resolves(expectedResponse);
|
||||
|
||||
await expect(retryIfServerError(fetchStub)).to.eventually.equal(
|
||||
expectedResponse
|
||||
);
|
||||
expect(fetchStub).to.be.calledTwice;
|
||||
});
|
||||
|
||||
it('does not retry again if the server returns a 5xx error twice', async () => {
|
||||
const expectedResponse = new Response(null, { status: 500 });
|
||||
fetchStub.onCall(0).resolves(new Response(null, { status: 500 }));
|
||||
fetchStub.onCall(1).resolves(expectedResponse);
|
||||
fetchStub.onCall(2).resolves(new Response());
|
||||
|
||||
await expect(retryIfServerError(fetchStub)).to.eventually.equal(
|
||||
expectedResponse
|
||||
);
|
||||
expect(fetchStub).to.be.calledTwice;
|
||||
});
|
||||
|
||||
it('does not retry if the error is not 5xx', async () => {
|
||||
const expectedResponse = new Response(null, { status: 404 });
|
||||
fetchStub.resolves(expectedResponse);
|
||||
|
||||
await expect(retryIfServerError(fetchStub)).to.eventually.equal(
|
||||
expectedResponse
|
||||
);
|
||||
expect(fetchStub).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('does not retry if response is ok', async () => {
|
||||
const expectedResponse = new Response();
|
||||
fetchStub.resolves(expectedResponse);
|
||||
|
||||
await expect(retryIfServerError(fetchStub)).to.eventually.equal(
|
||||
expectedResponse
|
||||
);
|
||||
expect(fetchStub).to.be.calledOnce;
|
||||
});
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
402
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/common.ts.html
generated
vendored
Normal file
402
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/common.ts.html
generated
vendored
Normal file
@@ -0,0 +1,402 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api/common.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">api</a> common.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>28/28</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>24/24</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">9x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">16x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { GenerateAuthTokenResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
CompletedAuthToken,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import {
|
||||
INSTALLATIONS_API_URL,
|
||||
INTERNAL_AUTH_VERSION
|
||||
} from '../util/constants';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
|
||||
export function getInstallationsEndpoint({ projectId }: AppConfig): string {
|
||||
return `${INSTALLATIONS_API_URL}/projects/${projectId}/installations`;
|
||||
}
|
||||
|
||||
export function extractAuthTokenInfoFromResponse(
|
||||
response: GenerateAuthTokenResponse
|
||||
): CompletedAuthToken {
|
||||
return {
|
||||
token: response.token,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),
|
||||
creationTime: Date.now()
|
||||
};
|
||||
}
|
||||
|
||||
export async function getErrorFromResponse(
|
||||
requestName: string,
|
||||
response: Response
|
||||
): Promise<FirebaseError> {
|
||||
const responseJson: ErrorResponse = await response.json();
|
||||
const errorData = responseJson.error;
|
||||
return ERROR_FACTORY.create(ErrorCode.REQUEST_FAILED, {
|
||||
requestName,
|
||||
serverCode: errorData.code,
|
||||
serverMessage: errorData.message,
|
||||
serverStatus: errorData.status
|
||||
});
|
||||
}
|
||||
|
||||
export function getHeaders({ apiKey }: AppConfig): Headers {
|
||||
return new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
'x-goog-api-key': apiKey
|
||||
});
|
||||
}
|
||||
|
||||
export function getHeadersWithAuth(
|
||||
appConfig: AppConfig,
|
||||
{ refreshToken }: RegisteredInstallationEntry
|
||||
): Headers {
|
||||
const headers = getHeaders(appConfig);
|
||||
headers.append('Authorization', getAuthorizationHeader(refreshToken));
|
||||
return headers;
|
||||
}
|
||||
|
||||
export interface ErrorResponse {
|
||||
error: {
|
||||
code: number;
|
||||
message: string;
|
||||
status: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the passed in fetch wrapper and returns the response.
|
||||
* If the returned response has a status of 5xx, re-runs the function once and
|
||||
* returns the response.
|
||||
*/
|
||||
export async function retryIfServerError(
|
||||
fn: () => Promise<Response>
|
||||
): Promise<Response> {
|
||||
const result = await fn();
|
||||
|
||||
if (result.status >= 500 && result.status < 600) {
|
||||
// Internal Server Error. Retry request.
|
||||
return fn();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getExpiresInFromResponseExpiresIn(responseExpiresIn: string): number {
|
||||
// This works because the server will never respond with fractions of a second.
|
||||
return Number(responseExpiresIn.replace('s', '000'));
|
||||
}
|
||||
|
||||
function getAuthorizationHeader(refreshToken: string): string {
|
||||
return `${INTERNAL_AUTH_VERSION} ${refreshToken}`;
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
561
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/create-installation.test.ts.html
generated
vendored
Normal file
561
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/create-installation.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,561 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api/create-installation.test.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">api</a> create-installation.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>53/53</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>46/46</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a>
|
||||
<a name='L137'></a><a href='#L137'>137</a>
|
||||
<a name='L138'></a><a href='#L138'>138</a>
|
||||
<a name='L139'></a><a href='#L139'>139</a>
|
||||
<a name='L140'></a><a href='#L140'>140</a>
|
||||
<a name='L141'></a><a href='#L141'>141</a>
|
||||
<a name='L142'></a><a href='#L142'>142</a>
|
||||
<a name='L143'></a><a href='#L143'>143</a>
|
||||
<a name='L144'></a><a href='#L144'>144</a>
|
||||
<a name='L145'></a><a href='#L145'>145</a>
|
||||
<a name='L146'></a><a href='#L146'>146</a>
|
||||
<a name='L147'></a><a href='#L147'>147</a>
|
||||
<a name='L148'></a><a href='#L148'>148</a>
|
||||
<a name='L149'></a><a href='#L149'>149</a>
|
||||
<a name='L150'></a><a href='#L150'>150</a>
|
||||
<a name='L151'></a><a href='#L151'>151</a>
|
||||
<a name='L152'></a><a href='#L152'>152</a>
|
||||
<a name='L153'></a><a href='#L153'>153</a>
|
||||
<a name='L154'></a><a href='#L154'>154</a>
|
||||
<a name='L155'></a><a href='#L155'>155</a>
|
||||
<a name='L156'></a><a href='#L156'>156</a>
|
||||
<a name='L157'></a><a href='#L157'>157</a>
|
||||
<a name='L158'></a><a href='#L158'>158</a>
|
||||
<a name='L159'></a><a href='#L159'>159</a>
|
||||
<a name='L160'></a><a href='#L160'>160</a>
|
||||
<a name='L161'></a><a href='#L161'>161</a>
|
||||
<a name='L162'></a><a href='#L162'>162</a>
|
||||
<a name='L163'></a><a href='#L163'>163</a>
|
||||
<a name='L164'></a><a href='#L164'>164</a>
|
||||
<a name='L165'></a><a href='#L165'>165</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { CreateInstallationResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { compareHeaders } from '../testing/compare-headers';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import {
|
||||
INSTALLATIONS_API_URL,
|
||||
INTERNAL_AUTH_VERSION,
|
||||
PACKAGE_VERSION
|
||||
} from '../util/constants';
|
||||
import { ErrorResponse } from './common';
|
||||
import { createInstallation } from './create-installation';
|
||||
|
||||
const FID = 'defenders-of-the-faith';
|
||||
|
||||
describe('createInstallation', () => {
|
||||
let appConfig: AppConfig;
|
||||
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
|
||||
let inProgressInstallationEntry: InProgressInstallationEntry;
|
||||
let response: CreateInstallationResponse;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = getFakeAppConfig();
|
||||
|
||||
inProgressInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: Date.now()
|
||||
};
|
||||
|
||||
response = {
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token:
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
|
||||
expiresIn: '604800s'
|
||||
},
|
||||
fid: FID
|
||||
};
|
||||
fetchSpy = stub(self, 'fetch');
|
||||
});
|
||||
|
||||
describe('successful request', () => {
|
||||
beforeEach(() => {
|
||||
fetchSpy.resolves(new Response(JSON.stringify(response)));
|
||||
});
|
||||
|
||||
it('registers a pending InstallationEntry', async () => {
|
||||
const registeredInstallationEntry = await createInstallation(
|
||||
appConfig,
|
||||
inProgressInstallationEntry
|
||||
);
|
||||
expect(registeredInstallationEntry.registrationStatus).to.equal(
|
||||
RequestStatus.COMPLETED
|
||||
);
|
||||
});
|
||||
|
||||
it('calls the createInstallation server API with correct parameters', async () => {
|
||||
const expectedHeaders = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
'x-goog-api-key': 'apiKey'
|
||||
});
|
||||
const expectedBody = {
|
||||
fid: FID,
|
||||
authVersion: INTERNAL_AUTH_VERSION,
|
||||
appId: appConfig.appId,
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
};
|
||||
const expectedRequest: RequestInit = {
|
||||
method: 'POST',
|
||||
headers: expectedHeaders,
|
||||
body: JSON.stringify(expectedBody)
|
||||
};
|
||||
const expectedEndpoint = `${INSTALLATIONS_API_URL}/projects/projectId/installations`;
|
||||
|
||||
await createInstallation(appConfig, inProgressInstallationEntry);
|
||||
expect(fetchSpy).to.be.calledOnceWith(expectedEndpoint, expectedRequest);
|
||||
const actualHeaders = fetchSpy.lastCall.lastArg.headers;
|
||||
compareHeaders(expectedHeaders, actualHeaders);
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the FID from the request if the response does not contain one', async () => {
|
||||
response = {
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token:
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
|
||||
expiresIn: '604800s'
|
||||
}
|
||||
};
|
||||
fetchSpy.resolves(new Response(JSON.stringify(response)));
|
||||
|
||||
const registeredInstallationEntry = await createInstallation(
|
||||
appConfig,
|
||||
inProgressInstallationEntry
|
||||
);
|
||||
expect(registeredInstallationEntry.fid).to.equal(FID);
|
||||
});
|
||||
|
||||
describe('failed request', () => {
|
||||
it('throws a FirebaseError with the error information from the server', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 409,
|
||||
message: 'Requested entity already exists',
|
||||
status: 'ALREADY_EXISTS'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy.resolves(
|
||||
new Response(JSON.stringify(errorResponse), { status: 409 })
|
||||
);
|
||||
|
||||
await expect(
|
||||
createInstallation(appConfig, inProgressInstallationEntry)
|
||||
).to.be.rejectedWith(FirebaseError);
|
||||
});
|
||||
|
||||
it('retries once if the server returns a 5xx error', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 500,
|
||||
message: 'Internal server error',
|
||||
status: 'SERVER_ERROR'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy
|
||||
.onCall(0)
|
||||
.resolves(new Response(JSON.stringify(errorResponse), { status: 500 }));
|
||||
fetchSpy.onCall(1).resolves(new Response(JSON.stringify(response)));
|
||||
|
||||
await expect(createInstallation(appConfig, inProgressInstallationEntry))
|
||||
.to.be.fulfilled;
|
||||
expect(fetchSpy).to.be.calledTwice;
|
||||
});
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
270
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/create-installation.ts.html
generated
vendored
Normal file
270
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/create-installation.ts.html
generated
vendored
Normal file
@@ -0,0 +1,270 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api/create-installation.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">api</a> create-installation.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>18/18</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>14/14</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CreateInstallationResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { INTERNAL_AUTH_VERSION, PACKAGE_VERSION } from '../util/constants';
|
||||
import {
|
||||
extractAuthTokenInfoFromResponse,
|
||||
getErrorFromResponse,
|
||||
getHeaders,
|
||||
getInstallationsEndpoint,
|
||||
retryIfServerError
|
||||
} from './common';
|
||||
|
||||
export async function createInstallation(
|
||||
appConfig: AppConfig,
|
||||
{ fid }: InProgressInstallationEntry
|
||||
): Promise<RegisteredInstallationEntry> {
|
||||
const endpoint = getInstallationsEndpoint(appConfig);
|
||||
|
||||
const headers = getHeaders(appConfig);
|
||||
const body = {
|
||||
fid,
|
||||
authVersion: INTERNAL_AUTH_VERSION,
|
||||
appId: appConfig.appId,
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
};
|
||||
|
||||
const request: RequestInit = {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(body)
|
||||
};
|
||||
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (response.ok) {
|
||||
const responseValue: CreateInstallationResponse = await response.json();
|
||||
const registeredInstallationEntry: RegisteredInstallationEntry = {
|
||||
fid: responseValue.fid || fid,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: responseValue.refreshToken,
|
||||
authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)
|
||||
};
|
||||
return registeredInstallationEntry;
|
||||
} else {
|
||||
throw await getErrorFromResponse('Create Installation', response);
|
||||
}
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
435
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/delete-installation.test.ts.html
generated
vendored
Normal file
435
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/delete-installation.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,435 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api/delete-installation.test.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">api</a> delete-installation.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>39/39</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>36/36</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { compareHeaders } from '../testing/compare-headers';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import {
|
||||
INSTALLATIONS_API_URL,
|
||||
INTERNAL_AUTH_VERSION
|
||||
} from '../util/constants';
|
||||
import { ErrorResponse } from './common';
|
||||
import { deleteInstallation } from './delete-installation';
|
||||
|
||||
const FID = 'foreclosure-of-a-dream';
|
||||
|
||||
describe('deleteInstallation', () => {
|
||||
let appConfig: AppConfig;
|
||||
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
|
||||
let registeredInstallationEntry: RegisteredInstallationEntry;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = getFakeAppConfig();
|
||||
|
||||
registeredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy = stub(self, 'fetch');
|
||||
});
|
||||
|
||||
describe('successful request', () => {
|
||||
beforeEach(() => {
|
||||
fetchSpy.resolves(new Response());
|
||||
});
|
||||
|
||||
it('calls the deleteInstallation server API with correct parameters', async () => {
|
||||
const expectedHeaders = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
Authorization: `${INTERNAL_AUTH_VERSION} refreshToken`,
|
||||
'x-goog-api-key': 'apiKey'
|
||||
});
|
||||
const expectedRequest: RequestInit = {
|
||||
method: 'DELETE',
|
||||
headers: expectedHeaders
|
||||
};
|
||||
const expectedEndpoint = `${INSTALLATIONS_API_URL}/projects/projectId/installations/${FID}`;
|
||||
|
||||
await deleteInstallation(appConfig, registeredInstallationEntry);
|
||||
|
||||
expect(fetchSpy).to.be.calledOnceWith(expectedEndpoint, expectedRequest);
|
||||
const actualHeaders = fetchSpy.lastCall.lastArg.headers;
|
||||
compareHeaders(expectedHeaders, actualHeaders);
|
||||
});
|
||||
});
|
||||
|
||||
describe('failed request', () => {
|
||||
it('throws a FirebaseError with the error information from the server', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 409,
|
||||
message: 'Requested entity already exists',
|
||||
status: 'ALREADY_EXISTS'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy.resolves(
|
||||
new Response(JSON.stringify(errorResponse), { status: 409 })
|
||||
);
|
||||
|
||||
await expect(
|
||||
deleteInstallation(appConfig, registeredInstallationEntry)
|
||||
).to.be.rejectedWith(FirebaseError);
|
||||
});
|
||||
|
||||
it('retries once if the server returns a 5xx error', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 500,
|
||||
message: 'Internal server error',
|
||||
status: 'SERVER_ERROR'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy
|
||||
.onCall(0)
|
||||
.resolves(new Response(JSON.stringify(errorResponse), { status: 500 }));
|
||||
fetchSpy.onCall(1).resolves(new Response());
|
||||
|
||||
await expect(deleteInstallation(appConfig, registeredInstallationEntry))
|
||||
.to.be.fulfilled;
|
||||
expect(fetchSpy).to.be.calledTwice;
|
||||
});
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
219
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/delete-installation.ts.html
generated
vendored
Normal file
219
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/delete-installation.ts.html
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api/delete-installation.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">api</a> delete-installation.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>13/13</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>10/10</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
||||
import {
|
||||
getErrorFromResponse,
|
||||
getHeadersWithAuth,
|
||||
getInstallationsEndpoint,
|
||||
retryIfServerError
|
||||
} from './common';
|
||||
|
||||
export async function deleteInstallation(
|
||||
appConfig: AppConfig,
|
||||
installationEntry: RegisteredInstallationEntry
|
||||
): Promise<void> {
|
||||
const endpoint = getDeleteEndpoint(appConfig, installationEntry);
|
||||
|
||||
const headers = getHeadersWithAuth(appConfig, installationEntry);
|
||||
const request: RequestInit = {
|
||||
method: 'DELETE',
|
||||
headers
|
||||
};
|
||||
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (!response.ok) {
|
||||
throw await getErrorFromResponse('Delete Installation', response);
|
||||
}
|
||||
}
|
||||
|
||||
function getDeleteEndpoint(
|
||||
appConfig: AppConfig,
|
||||
{ fid }: RegisteredInstallationEntry
|
||||
): string {
|
||||
return `${getInstallationsEndpoint(appConfig)}/${fid}`;
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
513
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/generate-auth-token.test.ts.html
generated
vendored
Normal file
513
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/generate-auth-token.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,513 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api/generate-auth-token.test.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">api</a> generate-auth-token.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>46/46</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>9/9</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>41/41</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a>
|
||||
<a name='L137'></a><a href='#L137'>137</a>
|
||||
<a name='L138'></a><a href='#L138'>138</a>
|
||||
<a name='L139'></a><a href='#L139'>139</a>
|
||||
<a name='L140'></a><a href='#L140'>140</a>
|
||||
<a name='L141'></a><a href='#L141'>141</a>
|
||||
<a name='L142'></a><a href='#L142'>142</a>
|
||||
<a name='L143'></a><a href='#L143'>143</a>
|
||||
<a name='L144'></a><a href='#L144'>144</a>
|
||||
<a name='L145'></a><a href='#L145'>145</a>
|
||||
<a name='L146'></a><a href='#L146'>146</a>
|
||||
<a name='L147'></a><a href='#L147'>147</a>
|
||||
<a name='L148'></a><a href='#L148'>148</a>
|
||||
<a name='L149'></a><a href='#L149'>149</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { GenerateAuthTokenResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
CompletedAuthToken,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { compareHeaders } from '../testing/compare-headers';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import {
|
||||
INSTALLATIONS_API_URL,
|
||||
INTERNAL_AUTH_VERSION,
|
||||
PACKAGE_VERSION
|
||||
} from '../util/constants';
|
||||
import { ErrorResponse } from './common';
|
||||
import { generateAuthToken } from './generate-auth-token';
|
||||
|
||||
const FID = 'evil-has-no-boundaries';
|
||||
|
||||
describe('generateAuthToken', () => {
|
||||
let appConfig: AppConfig;
|
||||
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
|
||||
let registeredInstallationEntry: RegisteredInstallationEntry;
|
||||
let response: GenerateAuthTokenResponse;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = getFakeAppConfig();
|
||||
|
||||
registeredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
};
|
||||
|
||||
response = {
|
||||
token:
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
|
||||
expiresIn: '604800s'
|
||||
};
|
||||
|
||||
fetchSpy = stub(self, 'fetch');
|
||||
});
|
||||
|
||||
describe('successful request', () => {
|
||||
beforeEach(() => {
|
||||
fetchSpy.resolves(new Response(JSON.stringify(response)));
|
||||
});
|
||||
|
||||
it('fetches a new Authentication Token', async () => {
|
||||
const completedAuthToken: CompletedAuthToken = await generateAuthToken(
|
||||
appConfig,
|
||||
registeredInstallationEntry
|
||||
);
|
||||
expect(completedAuthToken.requestStatus).to.equal(
|
||||
RequestStatus.COMPLETED
|
||||
);
|
||||
});
|
||||
|
||||
it('calls the generateAuthToken server API with correct parameters', async () => {
|
||||
const expectedHeaders = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
Authorization: `${INTERNAL_AUTH_VERSION} refreshToken`,
|
||||
'x-goog-api-key': 'apiKey'
|
||||
});
|
||||
const expectedBody = {
|
||||
installation: {
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
}
|
||||
};
|
||||
const expectedRequest: RequestInit = {
|
||||
method: 'POST',
|
||||
headers: expectedHeaders,
|
||||
body: JSON.stringify(expectedBody)
|
||||
};
|
||||
const expectedEndpoint = `${INSTALLATIONS_API_URL}/projects/projectId/installations/${FID}/authTokens:generate`;
|
||||
|
||||
await generateAuthToken(appConfig, registeredInstallationEntry);
|
||||
|
||||
expect(fetchSpy).to.be.calledOnceWith(expectedEndpoint, expectedRequest);
|
||||
const actualHeaders = fetchSpy.lastCall.lastArg.headers;
|
||||
compareHeaders(expectedHeaders, actualHeaders);
|
||||
});
|
||||
});
|
||||
|
||||
describe('failed request', () => {
|
||||
it('throws a FirebaseError with the error information from the server', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 409,
|
||||
message: 'Requested entity already exists',
|
||||
status: 'ALREADY_EXISTS'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy.resolves(
|
||||
new Response(JSON.stringify(errorResponse), { status: 409 })
|
||||
);
|
||||
|
||||
await expect(
|
||||
generateAuthToken(appConfig, registeredInstallationEntry)
|
||||
).to.be.rejectedWith(FirebaseError);
|
||||
});
|
||||
|
||||
it('retries once if the server returns a 5xx error', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 500,
|
||||
message: 'Internal server error',
|
||||
status: 'SERVER_ERROR'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy
|
||||
.onCall(0)
|
||||
.resolves(new Response(JSON.stringify(errorResponse), { status: 500 }));
|
||||
fetchSpy.onCall(1).resolves(new Response(JSON.stringify(response)));
|
||||
|
||||
await expect(generateAuthToken(appConfig, registeredInstallationEntry)).to
|
||||
.be.fulfilled;
|
||||
expect(fetchSpy).to.be.calledTwice;
|
||||
});
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
276
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/generate-auth-token.ts.html
generated
vendored
Normal file
276
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/generate-auth-token.ts.html
generated
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api/generate-auth-token.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">api</a> generate-auth-token.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>19/19</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>4/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>15/15</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { GenerateAuthTokenResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
CompletedAuthToken,
|
||||
RegisteredInstallationEntry
|
||||
} from '../interfaces/installation-entry';
|
||||
import { PACKAGE_VERSION } from '../util/constants';
|
||||
import {
|
||||
extractAuthTokenInfoFromResponse,
|
||||
getErrorFromResponse,
|
||||
getHeadersWithAuth,
|
||||
getInstallationsEndpoint,
|
||||
retryIfServerError
|
||||
} from './common';
|
||||
|
||||
export async function generateAuthToken(
|
||||
appConfig: AppConfig,
|
||||
installationEntry: RegisteredInstallationEntry
|
||||
): Promise<CompletedAuthToken> {
|
||||
const endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry);
|
||||
|
||||
const headers = getHeadersWithAuth(appConfig, installationEntry);
|
||||
const body = {
|
||||
installation: {
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
}
|
||||
};
|
||||
|
||||
const request: RequestInit = {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(body)
|
||||
};
|
||||
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (response.ok) {
|
||||
const responseValue: GenerateAuthTokenResponse = await response.json();
|
||||
const completedAuthToken: CompletedAuthToken = extractAuthTokenInfoFromResponse(
|
||||
responseValue
|
||||
);
|
||||
return completedAuthToken;
|
||||
} else {
|
||||
throw await getErrorFromResponse('Generate Auth Token', response);
|
||||
}
|
||||
}
|
||||
|
||||
function getGenerateAuthTokenEndpoint(
|
||||
appConfig: AppConfig,
|
||||
{ fid }: RegisteredInstallationEntry
|
||||
): string {
|
||||
return `${getInstallationsEndpoint(appConfig)}/${fid}/authTokens:generate`;
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
188
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/index.html
generated
vendored
Normal file
188
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/api/index.html
generated
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for api</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> api
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>251/251</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>21/21</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>50/50</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>217/217</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 high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="common.test.ts"><a href="common.test.ts.html">common.test.ts</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="35" class="abs high">35/35</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="7" class="abs high">7/7</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="31" class="abs high">31/31</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="common.ts"><a href="common.ts.html">common.ts</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="28" class="abs high">28/28</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="8" class="abs high">8/8</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="24" class="abs high">24/24</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="create-installation.test.ts"><a href="create-installation.test.ts.html">create-installation.test.ts</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="53" class="abs high">53/53</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="1" class="abs high">1/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="46" class="abs high">46/46</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="create-installation.ts"><a href="create-installation.ts.html">create-installation.ts</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="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="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="14" class="abs high">14/14</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="delete-installation.test.ts"><a href="delete-installation.test.ts.html">delete-installation.test.ts</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="39" class="abs high">39/39</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="8" class="abs high">8/8</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="36" class="abs high">36/36</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="delete-installation.ts"><a href="delete-installation.ts.html">delete-installation.ts</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="13" class="abs high">13/13</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="3" class="abs high">3/3</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="3" class="abs high">3/3</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="generate-auth-token.test.ts"><a href="generate-auth-token.test.ts.html">generate-auth-token.test.ts</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="46" class="abs high">46/46</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="1" class="abs high">1/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="9" class="abs high">9/9</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="41" class="abs high">41/41</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="generate-auth-token.ts"><a href="generate-auth-token.ts.html">generate-auth-token.ts</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="19" class="abs high">19/19</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="4" class="abs high">4/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="3" class="abs high">3/3</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="15" class="abs high">15/15</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
224
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/base.css
generated
vendored
Normal file
224
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/base.css
generated
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
body, html {
|
||||
margin:0; padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica, Arial;
|
||||
font-size: 14px;
|
||||
color:#333;
|
||||
}
|
||||
.small { font-size: 12px; }
|
||||
*, *:after, *:before {
|
||||
-webkit-box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
h1 { font-size: 20px; margin: 0;}
|
||||
h2 { font-size: 14px; }
|
||||
pre {
|
||||
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
a { color:#0074D9; text-decoration:none; }
|
||||
a:hover { text-decoration:underline; }
|
||||
.strong { font-weight: bold; }
|
||||
.space-top1 { padding: 10px 0 0 0; }
|
||||
.pad2y { padding: 20px 0; }
|
||||
.pad1y { padding: 10px 0; }
|
||||
.pad2x { padding: 0 20px; }
|
||||
.pad2 { padding: 20px; }
|
||||
.pad1 { padding: 10px; }
|
||||
.space-left2 { padding-left:55px; }
|
||||
.space-right2 { padding-right:20px; }
|
||||
.center { text-align:center; }
|
||||
.clearfix { display:block; }
|
||||
.clearfix:after {
|
||||
content:'';
|
||||
display:block;
|
||||
height:0;
|
||||
clear:both;
|
||||
visibility:hidden;
|
||||
}
|
||||
.fl { float: left; }
|
||||
@media only screen and (max-width:640px) {
|
||||
.col3 { width:100%; max-width:100%; }
|
||||
.hide-mobile { display:none!important; }
|
||||
}
|
||||
|
||||
.quiet {
|
||||
color: #7f7f7f;
|
||||
color: rgba(0,0,0,0.5);
|
||||
}
|
||||
.quiet a { opacity: 0.7; }
|
||||
|
||||
.fraction {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
background: #E8E8E8;
|
||||
padding: 4px 5px;
|
||||
border-radius: 3px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.path a:link, div.path a:visited { color: #333; }
|
||||
table.coverage {
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
text-align: right;
|
||||
padding: 0 5px 0 20px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
min-width:20px;
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 100%;
|
||||
}
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #333;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
.coverage-summary {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
||||
.keyline-all { border: 1px solid #ddd; }
|
||||
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
||||
.coverage-summary tbody { border: 1px solid #bbb; }
|
||||
.coverage-summary td { border-right: 1px solid #bbb; }
|
||||
.coverage-summary td:last-child { border-right: none; }
|
||||
.coverage-summary th {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.coverage-summary th.file { border-right: none !important; }
|
||||
.coverage-summary th.pct { }
|
||||
.coverage-summary th.pic,
|
||||
.coverage-summary th.abs,
|
||||
.coverage-summary td.pct,
|
||||
.coverage-summary td.abs { text-align: right; }
|
||||
.coverage-summary td.file { white-space: nowrap; }
|
||||
.coverage-summary td.pic { min-width: 120px !important; }
|
||||
.coverage-summary tfoot td { }
|
||||
|
||||
.coverage-summary .sorter {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
.coverage-summary .sorted .sorter {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
.coverage-summary .sorted-desc .sorter {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
.status-line { height: 10px; }
|
||||
/* yellow */
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
/* dark red */
|
||||
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
||||
.low .chart { border:1px solid #C21F39 }
|
||||
.highlighted,
|
||||
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
||||
background: #C21F39 !important;
|
||||
}
|
||||
/* medium red */
|
||||
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
||||
/* light red */
|
||||
.low, .cline-no { background:#FCE1E5 }
|
||||
/* light green */
|
||||
.high, .cline-yes { background:rgb(230,245,208) }
|
||||
/* medium green */
|
||||
.cstat-yes { background:rgb(161,215,106) }
|
||||
/* dark green */
|
||||
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
||||
.high .chart { border:1px solid rgb(77,146,33) }
|
||||
/* dark yellow (gold) */
|
||||
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
|
||||
.medium .chart { border:1px solid #f9cd0b; }
|
||||
/* light yellow */
|
||||
.medium { background: #fff4c2; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
span.cline-neutral { background: #eaeaea; }
|
||||
|
||||
.coverage-summary td.empty {
|
||||
opacity: .5;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
line-height: 1;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.cover-fill, .cover-empty {
|
||||
display:inline-block;
|
||||
height: 12px;
|
||||
}
|
||||
.chart {
|
||||
line-height: 0;
|
||||
}
|
||||
.cover-empty {
|
||||
background: white;
|
||||
}
|
||||
.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
.wrapper {
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%;
|
||||
margin: 0 auto -48px;
|
||||
}
|
||||
.footer, .push {
|
||||
height: 48px;
|
||||
}
|
||||
79
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/block-navigation.js
generated
vendored
Normal file
79
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/block-navigation.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/* eslint-disable */
|
||||
var jumpToCode = (function init() {
|
||||
// Classes of code we would like to highlight in the file view
|
||||
var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
|
||||
|
||||
// Elements to highlight in the file listing view
|
||||
var fileListingElements = ['td.pct.low'];
|
||||
|
||||
// We don't want to select elements that are direct descendants of another match
|
||||
var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
|
||||
|
||||
// Selecter that finds elements on the page to which we can jump
|
||||
var selector =
|
||||
fileListingElements.join(', ') +
|
||||
', ' +
|
||||
notSelector +
|
||||
missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
|
||||
|
||||
// The NodeList of matching elements
|
||||
var missingCoverageElements = document.querySelectorAll(selector);
|
||||
|
||||
var currentIndex;
|
||||
|
||||
function toggleClass(index) {
|
||||
missingCoverageElements
|
||||
.item(currentIndex)
|
||||
.classList.remove('highlighted');
|
||||
missingCoverageElements.item(index).classList.add('highlighted');
|
||||
}
|
||||
|
||||
function makeCurrent(index) {
|
||||
toggleClass(index);
|
||||
currentIndex = index;
|
||||
missingCoverageElements.item(index).scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
inline: 'center'
|
||||
});
|
||||
}
|
||||
|
||||
function goToPrevious() {
|
||||
var nextIndex = 0;
|
||||
if (typeof currentIndex !== 'number' || currentIndex === 0) {
|
||||
nextIndex = missingCoverageElements.length - 1;
|
||||
} else if (missingCoverageElements.length > 1) {
|
||||
nextIndex = currentIndex - 1;
|
||||
}
|
||||
|
||||
makeCurrent(nextIndex);
|
||||
}
|
||||
|
||||
function goToNext() {
|
||||
var nextIndex = 0;
|
||||
|
||||
if (
|
||||
typeof currentIndex === 'number' &&
|
||||
currentIndex < missingCoverageElements.length - 1
|
||||
) {
|
||||
nextIndex = currentIndex + 1;
|
||||
}
|
||||
|
||||
makeCurrent(nextIndex);
|
||||
}
|
||||
|
||||
return function jump(event) {
|
||||
switch (event.which) {
|
||||
case 78: // n
|
||||
case 74: // j
|
||||
goToNext();
|
||||
break;
|
||||
case 66: // b
|
||||
case 75: // k
|
||||
case 80: // p
|
||||
goToPrevious();
|
||||
break;
|
||||
}
|
||||
};
|
||||
})();
|
||||
window.addEventListener('keydown', jumpToCode);
|
||||
456
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/delete-installation.test.ts.html
generated
vendored
Normal file
456
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/delete-installation.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,456 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for functions/delete-installation.test.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">functions</a> delete-installation.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>48/48</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>43/43</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import * as deleteInstallationModule from '../api/delete-installation';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { get, set } from '../helpers/idb-manager';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus,
|
||||
UnregisteredInstallationEntry
|
||||
} from '../interfaces/installation-entry';
|
||||
import { getFakeApp } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { ErrorCode } from '../util/errors';
|
||||
import { sleep } from '../util/sleep';
|
||||
import { deleteInstallation } from './delete-installation';
|
||||
|
||||
const FID = 'children-of-the-damned';
|
||||
|
||||
describe('deleteInstallation', () => {
|
||||
let app: FirebaseApp;
|
||||
let appConfig: AppConfig;
|
||||
let deleteInstallationSpy: SinonStub<
|
||||
[AppConfig, RegisteredInstallationEntry],
|
||||
Promise<void>
|
||||
>;
|
||||
|
||||
beforeEach(() => {
|
||||
app = getFakeApp();
|
||||
appConfig = extractAppConfig(app);
|
||||
|
||||
deleteInstallationSpy = stub(
|
||||
deleteInstallationModule,
|
||||
'deleteInstallation'
|
||||
).callsFake(
|
||||
() => sleep(100) // Request would take some time
|
||||
);
|
||||
});
|
||||
|
||||
it('resolves without calling server API if there is no installation', async () => {
|
||||
await expect(deleteInstallation(app)).to.be.fulfilled;
|
||||
expect(deleteInstallationSpy).not.to.have.been.called;
|
||||
});
|
||||
|
||||
it('deletes and resolves without calling server API if the installation is unregistered', async () => {
|
||||
const entry: UnregisteredInstallationEntry = {
|
||||
registrationStatus: RequestStatus.NOT_STARTED,
|
||||
fid: FID
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
|
||||
await expect(deleteInstallation(app)).to.be.fulfilled;
|
||||
expect(deleteInstallationSpy).not.to.have.been.called;
|
||||
await expect(get(appConfig)).to.eventually.be.undefined;
|
||||
});
|
||||
|
||||
it('rejects without calling server API if the installation is pending', async () => {
|
||||
const entry: InProgressInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: Date.now() - 3 * 1000
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
|
||||
await expect(deleteInstallation(app)).to.be.rejectedWith(
|
||||
ErrorCode.DELETE_PENDING_REGISTRATION
|
||||
);
|
||||
expect(deleteInstallationSpy).not.to.have.been.called;
|
||||
});
|
||||
|
||||
it('rejects without calling server API if the installation is registered and app is offline', async () => {
|
||||
const entry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: 'authToken',
|
||||
expiresIn: 123456,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
await expect(deleteInstallation(app)).to.be.rejectedWith(
|
||||
ErrorCode.APP_OFFLINE
|
||||
);
|
||||
expect(deleteInstallationSpy).not.to.have.been.called;
|
||||
});
|
||||
|
||||
it('deletes and resolves after calling server API if the installation is registered', async () => {
|
||||
const entry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: 'authToken',
|
||||
expiresIn: 123456,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
|
||||
await expect(deleteInstallation(app)).to.be.fulfilled;
|
||||
expect(deleteInstallationSpy).to.have.been.calledOnceWith(appConfig, entry);
|
||||
await expect(get(appConfig)).to.eventually.be.undefined;
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
240
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/delete-installation.ts.html
generated
vendored
Normal file
240
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/delete-installation.ts.html
generated
vendored
Normal file
@@ -0,0 +1,240 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for functions/delete-installation.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">functions</a> delete-installation.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>19/19</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">92.31% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>12/13</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>18/18</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { deleteInstallation as deleteInstallationRequest } from '../api/delete-installation';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { remove, update } from '../helpers/idb-manager';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
InstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
|
||||
export async function deleteInstallation(app: FirebaseApp): Promise<void> {
|
||||
const appConfig = extractAppConfig(app);
|
||||
|
||||
const entry = await update(appConfig, (oldEntry?: InstallationEntry):
|
||||
| InProgressInstallationEntry
|
||||
| RegisteredInstallationEntry
|
||||
| undefined => {
|
||||
if (oldEntry && oldEntry.registrationStatus === RequestStatus.NOT_STARTED) {
|
||||
// Delete the unregistered entry without sending a deleteInstallation request.
|
||||
return undefined;
|
||||
}
|
||||
return oldEntry;
|
||||
});
|
||||
|
||||
if (entry) {
|
||||
if (entry.registrationStatus === RequestStatus.IN_PROGRESS) {
|
||||
// Can't delete while trying to register.
|
||||
throw ERROR_FACTORY.create(ErrorCode.DELETE_PENDING_REGISTRATION);
|
||||
} else if (<span class="missing-if-branch" title="if path not taken" >I</span>entry.registrationStatus === RequestStatus.COMPLETED) {
|
||||
if (!navigator.onLine) {
|
||||
throw ERROR_FACTORY.create(ErrorCode.APP_OFFLINE);
|
||||
} else {
|
||||
await deleteInstallationRequest(appConfig, entry);
|
||||
await remove(appConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
303
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/get-id.test.ts.html
generated
vendored
Normal file
303
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/get-id.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for functions/get-id.test.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">functions</a> get-id.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>26/26</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>4/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>23/23</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import * as getInstallationEntryModule from '../helpers/get-installation-entry';
|
||||
import * as refreshAuthTokenModule from '../helpers/refresh-auth-token';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { RequestStatus } from '../interfaces/installation-entry';
|
||||
import { getFakeApp } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { getId } from './get-id';
|
||||
|
||||
const FID = 'disciples-of-the-watch';
|
||||
|
||||
describe('getId', () => {
|
||||
let getInstallationEntrySpy: SinonStub<
|
||||
[AppConfig],
|
||||
Promise<getInstallationEntryModule.InstallationEntryWithRegistrationPromise>
|
||||
>;
|
||||
|
||||
beforeEach(() => {
|
||||
getInstallationEntrySpy = stub(
|
||||
getInstallationEntryModule,
|
||||
'getInstallationEntry'
|
||||
);
|
||||
});
|
||||
|
||||
it('returns the FID in InstallationEntry returned by getInstallationEntry', async () => {
|
||||
getInstallationEntrySpy.resolves({
|
||||
installationEntry: {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
});
|
||||
|
||||
const firebaseApp = getFakeApp();
|
||||
const fid = await getId(firebaseApp);
|
||||
expect(fid).to.equal(FID);
|
||||
expect(getInstallationEntrySpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('calls refreshAuthToken if the installation is registered', async () => {
|
||||
getInstallationEntrySpy.resolves({
|
||||
installationEntry: {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const refreshAuthTokenSpy = stub(
|
||||
refreshAuthTokenModule,
|
||||
'refreshAuthToken'
|
||||
).resolves('authToken');
|
||||
|
||||
const firebaseApp = getFakeApp();
|
||||
await getId(firebaseApp);
|
||||
expect(refreshAuthTokenSpy).to.be.calledOnce;
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
195
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/get-id.ts.html
generated
vendored
Normal file
195
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/get-id.ts.html
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for functions/get-id.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">functions</a> get-id.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">91.67% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>11/12</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">75% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>3/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">33.33% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>1/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">90.91% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>10/11</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { getInstallationEntry } from '../helpers/get-installation-entry';
|
||||
import { refreshAuthToken } from '../helpers/refresh-auth-token';
|
||||
import { RequestStatus } from '../interfaces/installation-entry';
|
||||
|
||||
export async function getId(app: FirebaseApp): Promise<string> {
|
||||
const appConfig = extractAppConfig(app);
|
||||
const { installationEntry, registrationPromise } = await getInstallationEntry(
|
||||
appConfig
|
||||
);
|
||||
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (registrationPromise) {
|
||||
// Suppress registration errors as they are not a problem for getId.
|
||||
<span class="cstat-no" title="statement not covered" > registrationPromise.catch(<span class="fstat-no" title="function not covered" >() => {}</span>);</span>
|
||||
}
|
||||
|
||||
if (installationEntry.registrationStatus === RequestStatus.COMPLETED) {
|
||||
// If the installation is already registered, update the authentication
|
||||
// token if needed. Suppress errors as they are not relevant to getId.
|
||||
refreshAuthToken(appConfig).catch(<span class="fstat-no" title="function not covered" >() => {}</span>);
|
||||
}
|
||||
|
||||
return installationEntry.fid;
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1419
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/get-token.test.ts.html
generated
vendored
Normal file
1419
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/get-token.test.ts.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
219
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/get-token.ts.html
generated
vendored
Normal file
219
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/get-token.ts.html
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for functions/get-token.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">functions</a> get-token.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">92.86% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>13/14</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">80% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>4/5</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">92.31% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>12/13</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">42x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">84x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">41x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">42x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">75x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-yes">33x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { getInstallationEntry } from '../helpers/get-installation-entry';
|
||||
import { refreshAuthToken } from '../helpers/refresh-auth-token';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { RequestStatus } from '../interfaces/installation-entry';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
|
||||
export async function getToken(app: FirebaseApp): Promise<string> {
|
||||
const appConfig = extractAppConfig(app);
|
||||
|
||||
await completeInstallationRegistration(appConfig);
|
||||
|
||||
// At this point we either have a Registered Installation in the DB, or we've
|
||||
// already thrown an error.
|
||||
return refreshAuthToken(appConfig);
|
||||
}
|
||||
|
||||
async function completeInstallationRegistration(
|
||||
appConfig: AppConfig
|
||||
): Promise<void> {
|
||||
const { installationEntry, registrationPromise } = await getInstallationEntry(
|
||||
appConfig
|
||||
);
|
||||
|
||||
if (registrationPromise) {
|
||||
// A createInstallation request is in progress. Wait until it finishes.
|
||||
await registrationPromise;
|
||||
} else <span class="missing-if-branch" title="if path not taken" >I</span>if (installationEntry.registrationStatus !== RequestStatus.COMPLETED) {
|
||||
// Installation ID can't be registered.
|
||||
<span class="cstat-no" title="statement not covered" > throw ERROR_FACTORY.create(ErrorCode.CREATE_INSTALLATION_FAILED);</span>
|
||||
}
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
162
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/index.html
generated
vendored
Normal file
162
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/functions/index.html
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for functions</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> functions
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">99.35% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>307/309</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">91.43% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>32/35</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">97.18% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>69/71</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">99.23% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>257/259</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 high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="delete-installation.test.ts"><a href="delete-installation.test.ts.html">delete-installation.test.ts</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="48" class="abs high">48/48</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="1" class="abs high">1/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="43" class="abs high">43/43</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="delete-installation.ts"><a href="delete-installation.ts.html">delete-installation.ts</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="19" class="abs high">19/19</td>
|
||||
<td data-value="92.31" class="pct high">92.31%</td>
|
||||
<td data-value="13" class="abs high">12/13</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="18" class="abs high">18/18</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="get-id.test.ts"><a href="get-id.test.ts.html">get-id.test.ts</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="26" class="abs high">26/26</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="4" class="abs high">4/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="23" class="abs high">23/23</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="get-id.ts"><a href="get-id.ts.html">get-id.ts</a></td>
|
||||
<td data-value="91.67" class="pic high"><div class="chart"><div class="cover-fill" style="width: 91%;"></div><div class="cover-empty" style="width:9%;"></div></div></td>
|
||||
<td data-value="91.67" class="pct high">91.67%</td>
|
||||
<td data-value="12" class="abs high">11/12</td>
|
||||
<td data-value="75" class="pct medium">75%</td>
|
||||
<td data-value="4" class="abs medium">3/4</td>
|
||||
<td data-value="33.33" class="pct low">33.33%</td>
|
||||
<td data-value="3" class="abs low">1/3</td>
|
||||
<td data-value="90.91" class="pct high">90.91%</td>
|
||||
<td data-value="11" class="abs high">10/11</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="get-token.test.ts"><a href="get-token.test.ts.html">get-token.test.ts</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="190" class="abs high">190/190</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="12" class="abs high">12/12</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="52" class="abs high">52/52</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="151" class="abs high">151/151</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="get-token.ts"><a href="get-token.ts.html">get-token.ts</a></td>
|
||||
<td data-value="92.86" class="pic high"><div class="chart"><div class="cover-fill" style="width: 92%;"></div><div class="cover-empty" style="width:8%;"></div></div></td>
|
||||
<td data-value="92.86" class="pct high">92.86%</td>
|
||||
<td data-value="14" class="abs high">13/14</td>
|
||||
<td data-value="80" class="pct high">80%</td>
|
||||
<td data-value="5" class="abs high">4/5</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="92.31" class="pct high">92.31%</td>
|
||||
<td data-value="13" class="abs high">12/13</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
162
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/buffer-to-base64-url-safe.test.ts.html
generated
vendored
Normal file
162
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/buffer-to-base64-url-safe.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/buffer-to-base64-url-safe.test.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">helpers</a> buffer-to-base64-url-safe.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>8/8</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import '../testing/setup';
|
||||
import { bufferToBase64UrlSafe } from './buffer-to-base64-url-safe';
|
||||
|
||||
const TYPED_ARRAY_REPRESENTATION = new TextEncoder().encode('hello world');
|
||||
const BASE_64_REPRESENTATION = btoa('hello world');
|
||||
|
||||
describe('bufferToBase64', () => {
|
||||
it('returns a base64 representation of a Uint8Array', () => {
|
||||
expect(bufferToBase64UrlSafe(TYPED_ARRAY_REPRESENTATION)).to.equal(
|
||||
BASE_64_REPRESENTATION
|
||||
);
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
132
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/buffer-to-base64-url-safe.ts.html
generated
vendored
Normal file
132
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/buffer-to-base64-url-safe.ts.html
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/buffer-to-base64-url-safe.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">helpers</a> buffer-to-base64-url-safe.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>3/3</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">201022x</span>
|
||||
<span class="cline-any cline-yes">201022x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function bufferToBase64UrlSafe(array: Uint8Array): string {
|
||||
const b64 = btoa(String.fromCharCode(...array));
|
||||
return b64.replace(/\+/g, '-').replace(/\//g, '_');
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
249
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/extract-app-config.test.ts.html
generated
vendored
Normal file
249
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/extract-app-config.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/extract-app-config.test.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">helpers</a> extract-app-config.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>33/33</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>9/9</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>27/27</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </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"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </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"> </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"> </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"> </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"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { expect } from 'chai';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { getFakeApp } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { extractAppConfig } from './extract-app-config';
|
||||
|
||||
describe('extractAppConfig', () => {
|
||||
it('returns AppConfig if the argument is a FirebaseApp object that includes an appId', () => {
|
||||
const firebaseApp = getFakeApp();
|
||||
const expected: AppConfig = {
|
||||
appName: 'appName',
|
||||
apiKey: 'apiKey',
|
||||
projectId: 'projectId',
|
||||
appId: '1:777777777777:web:d93b5ca1475efe57'
|
||||
};
|
||||
expect(extractAppConfig(firebaseApp)).to.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('throws if a necessary value is missing', () => {
|
||||
expect(() => extractAppConfig(undefined as any)).to.throw(FirebaseError);
|
||||
|
||||
let firebaseApp = getFakeApp();
|
||||
delete firebaseApp.name;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
|
||||
firebaseApp = getFakeApp();
|
||||
delete firebaseApp.options;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
|
||||
firebaseApp = getFakeApp();
|
||||
delete firebaseApp.options.projectId;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
|
||||
firebaseApp = getFakeApp();
|
||||
delete firebaseApp.options.apiKey;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
|
||||
firebaseApp = getFakeApp();
|
||||
delete firebaseApp.options.appId;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
174
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/extract-app-config.ts.html
generated
vendored
Normal file
174
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/extract-app-config.ts.html
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/extract-app-config.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">helpers</a> extract-app-config.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>12/12</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>9/9</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">152x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">150x</span>
|
||||
<span class="cline-any cline-yes">150x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">150x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">146x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
|
||||
export function extractAppConfig(app: FirebaseApp): AppConfig {
|
||||
if (!app || !app.options) {
|
||||
throw ERROR_FACTORY.create(ErrorCode.MISSING_APP_CONFIG_VALUES);
|
||||
}
|
||||
|
||||
const appName = app.name;
|
||||
const { projectId, apiKey, appId } = app.options;
|
||||
|
||||
if (!appName || !projectId || !apiKey || !appId) {
|
||||
throw ERROR_FACTORY.create(ErrorCode.MISSING_APP_CONFIG_VALUES);
|
||||
}
|
||||
|
||||
return { appName, projectId, apiKey, appId };
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
453
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/generate-fid.test.ts.html
generated
vendored
Normal file
453
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/generate-fid.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,453 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/generate-fid.test.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">helpers</a> generate-fid.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">98% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>49/50</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">83.33% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>5/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">97.78% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>44/45</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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">12x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-yes">204x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1000x</span>
|
||||
<span class="cline-any cline-yes">1000x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">200000x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">200000x</span>
|
||||
<span class="cline-any cline-yes">4400000x</span>
|
||||
<span class="cline-any cline-yes">4400000x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1348x</span>
|
||||
<span class="cline-any cline-yes">1348x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1348x</span>
|
||||
<span class="cline-any cline-yes">1348x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { stub } from 'sinon';
|
||||
import '../testing/setup';
|
||||
import { generateFid, VALID_FID_PATTERN } from './generate-fid';
|
||||
|
||||
/** A few random values to generate a FID from. */
|
||||
// prettier-ignore
|
||||
const MOCK_RANDOM_VALUES = [
|
||||
[14, 107, 44, 183, 190, 84, 253, 45, 219, 233, 43, 190, 240, 152, 195, 222, 237],
|
||||
[184, 251, 91, 157, 125, 225, 209, 15, 116, 66, 46, 113, 194, 126, 16, 13, 226],
|
||||
[197, 123, 13, 142, 239, 129, 252, 139, 156, 36, 219, 192, 153, 52, 182, 231, 177],
|
||||
[69, 154, 197, 91, 156, 196, 125, 111, 3, 67, 212, 132, 169, 11, 14, 254, 125],
|
||||
[193, 102, 58, 19, 244, 69, 36, 135, 170, 106, 98, 216, 246, 209, 24, 155, 149],
|
||||
[252, 59, 222, 160, 82, 160, 82, 186, 14, 172, 196, 114, 146, 191, 196, 194, 146],
|
||||
[64, 147, 153, 236, 225, 142, 235, 109, 184, 249, 174, 127, 33, 238, 227, 172, 111],
|
||||
[129, 137, 136, 120, 248, 206, 253, 78, 159, 201, 216, 15, 246, 80, 118, 185, 211],
|
||||
[117, 150, 2, 180, 116, 230, 45, 188, 183, 43, 152, 100, 50, 255, 101, 175, 190],
|
||||
[156, 129, 30, 101, 58, 137, 217, 249, 12, 227, 235, 80, 248, 81, 191, 2, 5],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
|
||||
];
|
||||
|
||||
/** The FIDs that should be generated based on MOCK_RANDOM_VALUES. */
|
||||
const EXPECTED_FIDS = [
|
||||
'fmsst75U_S3b6Su-8JjD3u',
|
||||
'ePtbnX3h0Q90Qi5xwn4QDe',
|
||||
'dXsNju-B_IucJNvAmTS257',
|
||||
'dZrFW5zEfW8DQ9SEqQsO_n',
|
||||
'cWY6E_RFJIeqamLY9tEYm5',
|
||||
'fDveoFKgUroOrMRykr_Ewp',
|
||||
'cJOZ7OGO6224-a5_Ie7jrG',
|
||||
'cYmIePjO_U6fydgP9lB2ud',
|
||||
'dZYCtHTmLby3K5hkMv9lr7',
|
||||
'fIEeZTqJ2fkM4-tQ-FG_Ag',
|
||||
'cAAAAAAAAAAAAAAAAAAAAA',
|
||||
'f_____________________'
|
||||
];
|
||||
|
||||
describe('generateFid', () => {
|
||||
it('deterministically generates FIDs based on crypto.getRandomValues', () => {
|
||||
let randomValueIndex = 0;
|
||||
stub(crypto, 'getRandomValues').callsFake(array => {
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (!(array instanceof Uint8Array)) {
|
||||
<span class="cstat-no" title="statement not covered" > throw new Error('what');</span>
|
||||
}
|
||||
const values = MOCK_RANDOM_VALUES[randomValueIndex++];
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
array[i] = values[i];
|
||||
}
|
||||
return array;
|
||||
});
|
||||
|
||||
for (const expectedFid of EXPECTED_FIDS) {
|
||||
expect(generateFid()).to.deep.equal(expectedFid);
|
||||
}
|
||||
});
|
||||
|
||||
it('generates valid FIDs', () => {
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
const fid = generateFid();
|
||||
expect(VALID_FID_PATTERN.test(fid)).to.equal(
|
||||
true,
|
||||
`${fid} is not a valid FID`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it('generates FIDs where each character is equally likely to appear in each location', () => {
|
||||
const numTries = 200000;
|
||||
|
||||
const charOccurrencesMapList: Array<Map<string, number>> = new Array(22);
|
||||
for (let i = 0; i < charOccurrencesMapList.length; i++) {
|
||||
charOccurrencesMapList[i] = new Map();
|
||||
}
|
||||
|
||||
for (let i = 0; i < numTries; i++) {
|
||||
const fid = generateFid();
|
||||
|
||||
Array.from(fid).forEach((char, location) => {
|
||||
const map = charOccurrencesMapList[location];
|
||||
map.set(char, (map.get(char) || 0) + 1);
|
||||
});
|
||||
}
|
||||
|
||||
for (let i = 0; i < charOccurrencesMapList.length; i++) {
|
||||
const map = charOccurrencesMapList[i];
|
||||
if (i === 0) {
|
||||
// In the first location only 4 characters (c, d, e, f) are valid.
|
||||
expect(map.size).to.equal(4);
|
||||
} else {
|
||||
// In locations other than the first, all 64 characters are valid.
|
||||
expect(map.size).to.equal(64);
|
||||
}
|
||||
|
||||
Array.from(map.entries()).forEach(([_, occurrence]) => {
|
||||
const expectedOccurrence = numTries / map.size;
|
||||
|
||||
// 10% margin of error
|
||||
expect(occurrence).to.be.above(expectedOccurrence * 0.9);
|
||||
expect(occurrence).to.be.below(expectedOccurrence * 1.1);
|
||||
});
|
||||
}
|
||||
}).timeout(30000);
|
||||
|
||||
it('returns an empty string if FID generation fails', () => {
|
||||
stub(crypto, 'getRandomValues').throws();
|
||||
|
||||
const fid = generateFid();
|
||||
expect(fid).to.equal('');
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
234
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/generate-fid.ts.html
generated
vendored
Normal file
234
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/generate-fid.ts.html
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/generate-fid.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">helpers</a> generate-fid.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>14/14</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">50% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>2/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>14/14</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-yes">201022x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">201022x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">201022x</span>
|
||||
<span class="cline-any cline-yes">201022x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">201021x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">201021x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">201021x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">201021x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">201021x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { bufferToBase64UrlSafe } from './buffer-to-base64-url-safe';
|
||||
|
||||
export const VALID_FID_PATTERN = /^[cdef][\w-]{21}$/;
|
||||
export const INVALID_FID = '';
|
||||
|
||||
/**
|
||||
* Generates a new FID using random values from Web Crypto API.
|
||||
* Returns an empty string if FID generation fails for any reason.
|
||||
*/
|
||||
export function generateFid(): string {
|
||||
try {
|
||||
// A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5
|
||||
// bytes. our implementation generates a 17 byte array instead.
|
||||
const fidByteArray = new Uint8Array(17);
|
||||
const crypto =
|
||||
self.crypto || ((<span class="branch-1 cbranch-no" title="branch not covered" >self as unknown) as { msCrypto: Crypto }).msCrypto;</span>
|
||||
crypto.getRandomValues(fidByteArray);
|
||||
|
||||
// Replace the first 4 random bits with the constant FID header of 0b0111.
|
||||
fidByteArray[0] = 0b01110000 + (fidByteArray[0] % 0b00010000);
|
||||
|
||||
const fid = encode(fidByteArray);
|
||||
|
||||
return VALID_FID_PATTERN.test(fid) ? fid : <span class="branch-1 cbranch-no" title="branch not covered" >INVALID_FID;</span>
|
||||
} catch {
|
||||
// FID generation errored
|
||||
return INVALID_FID;
|
||||
}
|
||||
}
|
||||
|
||||
/** Converts a FID Uint8Array to a base64 string representation. */
|
||||
function encode(fidByteArray: Uint8Array): string {
|
||||
const b64String = bufferToBase64UrlSafe(fidByteArray);
|
||||
|
||||
// Remove the 23rd character that was added because of the extra 4 bits at the
|
||||
// end of our 17 byte array, and the '=' padding.
|
||||
return b64String.substr(0, 22);
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1257
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/get-installation-entry.test.ts.html
generated
vendored
Normal file
1257
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/get-installation-entry.test.ts.html
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
723
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/get-installation-entry.ts.html
generated
vendored
Normal file
723
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/get-installation-entry.ts.html
generated
vendored
Normal file
@@ -0,0 +1,723 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/get-installation-entry.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">helpers</a> get-installation-entry.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">94.55% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>52/55</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">90% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>27/30</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>9/9</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">93.88% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>46/49</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a>
|
||||
<a name='L137'></a><a href='#L137'>137</a>
|
||||
<a name='L138'></a><a href='#L138'>138</a>
|
||||
<a name='L139'></a><a href='#L139'>139</a>
|
||||
<a name='L140'></a><a href='#L140'>140</a>
|
||||
<a name='L141'></a><a href='#L141'>141</a>
|
||||
<a name='L142'></a><a href='#L142'>142</a>
|
||||
<a name='L143'></a><a href='#L143'>143</a>
|
||||
<a name='L144'></a><a href='#L144'>144</a>
|
||||
<a name='L145'></a><a href='#L145'>145</a>
|
||||
<a name='L146'></a><a href='#L146'>146</a>
|
||||
<a name='L147'></a><a href='#L147'>147</a>
|
||||
<a name='L148'></a><a href='#L148'>148</a>
|
||||
<a name='L149'></a><a href='#L149'>149</a>
|
||||
<a name='L150'></a><a href='#L150'>150</a>
|
||||
<a name='L151'></a><a href='#L151'>151</a>
|
||||
<a name='L152'></a><a href='#L152'>152</a>
|
||||
<a name='L153'></a><a href='#L153'>153</a>
|
||||
<a name='L154'></a><a href='#L154'>154</a>
|
||||
<a name='L155'></a><a href='#L155'>155</a>
|
||||
<a name='L156'></a><a href='#L156'>156</a>
|
||||
<a name='L157'></a><a href='#L157'>157</a>
|
||||
<a name='L158'></a><a href='#L158'>158</a>
|
||||
<a name='L159'></a><a href='#L159'>159</a>
|
||||
<a name='L160'></a><a href='#L160'>160</a>
|
||||
<a name='L161'></a><a href='#L161'>161</a>
|
||||
<a name='L162'></a><a href='#L162'>162</a>
|
||||
<a name='L163'></a><a href='#L163'>163</a>
|
||||
<a name='L164'></a><a href='#L164'>164</a>
|
||||
<a name='L165'></a><a href='#L165'>165</a>
|
||||
<a name='L166'></a><a href='#L166'>166</a>
|
||||
<a name='L167'></a><a href='#L167'>167</a>
|
||||
<a name='L168'></a><a href='#L168'>168</a>
|
||||
<a name='L169'></a><a href='#L169'>169</a>
|
||||
<a name='L170'></a><a href='#L170'>170</a>
|
||||
<a name='L171'></a><a href='#L171'>171</a>
|
||||
<a name='L172'></a><a href='#L172'>172</a>
|
||||
<a name='L173'></a><a href='#L173'>173</a>
|
||||
<a name='L174'></a><a href='#L174'>174</a>
|
||||
<a name='L175'></a><a href='#L175'>175</a>
|
||||
<a name='L176'></a><a href='#L176'>176</a>
|
||||
<a name='L177'></a><a href='#L177'>177</a>
|
||||
<a name='L178'></a><a href='#L178'>178</a>
|
||||
<a name='L179'></a><a href='#L179'>179</a>
|
||||
<a name='L180'></a><a href='#L180'>180</a>
|
||||
<a name='L181'></a><a href='#L181'>181</a>
|
||||
<a name='L182'></a><a href='#L182'>182</a>
|
||||
<a name='L183'></a><a href='#L183'>183</a>
|
||||
<a name='L184'></a><a href='#L184'>184</a>
|
||||
<a name='L185'></a><a href='#L185'>185</a>
|
||||
<a name='L186'></a><a href='#L186'>186</a>
|
||||
<a name='L187'></a><a href='#L187'>187</a>
|
||||
<a name='L188'></a><a href='#L188'>188</a>
|
||||
<a name='L189'></a><a href='#L189'>189</a>
|
||||
<a name='L190'></a><a href='#L190'>190</a>
|
||||
<a name='L191'></a><a href='#L191'>191</a>
|
||||
<a name='L192'></a><a href='#L192'>192</a>
|
||||
<a name='L193'></a><a href='#L193'>193</a>
|
||||
<a name='L194'></a><a href='#L194'>194</a>
|
||||
<a name='L195'></a><a href='#L195'>195</a>
|
||||
<a name='L196'></a><a href='#L196'>196</a>
|
||||
<a name='L197'></a><a href='#L197'>197</a>
|
||||
<a name='L198'></a><a href='#L198'>198</a>
|
||||
<a name='L199'></a><a href='#L199'>199</a>
|
||||
<a name='L200'></a><a href='#L200'>200</a>
|
||||
<a name='L201'></a><a href='#L201'>201</a>
|
||||
<a name='L202'></a><a href='#L202'>202</a>
|
||||
<a name='L203'></a><a href='#L203'>203</a>
|
||||
<a name='L204'></a><a href='#L204'>204</a>
|
||||
<a name='L205'></a><a href='#L205'>205</a>
|
||||
<a name='L206'></a><a href='#L206'>206</a>
|
||||
<a name='L207'></a><a href='#L207'>207</a>
|
||||
<a name='L208'></a><a href='#L208'>208</a>
|
||||
<a name='L209'></a><a href='#L209'>209</a>
|
||||
<a name='L210'></a><a href='#L210'>210</a>
|
||||
<a name='L211'></a><a href='#L211'>211</a>
|
||||
<a name='L212'></a><a href='#L212'>212</a>
|
||||
<a name='L213'></a><a href='#L213'>213</a>
|
||||
<a name='L214'></a><a href='#L214'>214</a>
|
||||
<a name='L215'></a><a href='#L215'>215</a>
|
||||
<a name='L216'></a><a href='#L216'>216</a>
|
||||
<a name='L217'></a><a href='#L217'>217</a>
|
||||
<a name='L218'></a><a href='#L218'>218</a>
|
||||
<a name='L219'></a><a href='#L219'>219</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">64x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">64x</span>
|
||||
<span class="cline-any cline-yes">64x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">64x</span>
|
||||
<span class="cline-any cline-yes">64x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">127x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">63x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">64x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">64x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">62x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">64x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">17x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">17x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">17x</span>
|
||||
<span class="cline-any cline-yes">42x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">35x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">17x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">8x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">7x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">86x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { createInstallation } from '../api/create-installation';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
InstallationEntry,
|
||||
RequestStatus,
|
||||
RegisteredInstallationEntry
|
||||
} from '../interfaces/installation-entry';
|
||||
import { PENDING_TIMEOUT_MS } from '../util/constants';
|
||||
import { ERROR_FACTORY, ErrorCode, isServerError } from '../util/errors';
|
||||
import { sleep } from '../util/sleep';
|
||||
import { generateFid, INVALID_FID } from './generate-fid';
|
||||
import { remove, set, update } from './idb-manager';
|
||||
|
||||
export interface InstallationEntryWithRegistrationPromise {
|
||||
installationEntry: InstallationEntry;
|
||||
registrationPromise?: Promise<RegisteredInstallationEntry>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates and returns the InstallationEntry from the database.
|
||||
* Also triggers a registration request if it is necessary and possible.
|
||||
*/
|
||||
export async function getInstallationEntry(
|
||||
appConfig: AppConfig
|
||||
): Promise<InstallationEntryWithRegistrationPromise> {
|
||||
let registrationPromise: Promise<RegisteredInstallationEntry> | undefined;
|
||||
|
||||
const installationEntry = await update(
|
||||
appConfig,
|
||||
(oldEntry?: InstallationEntry): InstallationEntry => {
|
||||
const installationEntry = updateOrCreateInstallationEntry(oldEntry);
|
||||
const entryWithPromise = triggerRegistrationIfNecessary(
|
||||
appConfig,
|
||||
installationEntry
|
||||
);
|
||||
registrationPromise = entryWithPromise.registrationPromise;
|
||||
return entryWithPromise.installationEntry;
|
||||
}
|
||||
);
|
||||
|
||||
if (installationEntry.fid === INVALID_FID) {
|
||||
// FID generation failed. Waiting for the FID from the server.
|
||||
return { installationEntry: await registrationPromise! };
|
||||
}
|
||||
|
||||
return {
|
||||
installationEntry,
|
||||
registrationPromise
|
||||
};
|
||||
}
|
||||
|
||||
function updateOrCreateInstallationEntry(
|
||||
oldEntry: InstallationEntry | undefined
|
||||
): InstallationEntry {
|
||||
const entry: InstallationEntry = oldEntry || {
|
||||
fid: generateFid(),
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
};
|
||||
|
||||
if (hasInstallationRequestTimedOut(entry)) {
|
||||
return {
|
||||
fid: entry.fid,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
};
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* If the Firebase Installation is not registered yet, this will trigger the registration
|
||||
* and return an InProgressInstallationEntry.
|
||||
*/
|
||||
function triggerRegistrationIfNecessary(
|
||||
appConfig: AppConfig,
|
||||
installationEntry: InstallationEntry
|
||||
): InstallationEntryWithRegistrationPromise {
|
||||
if (installationEntry.registrationStatus === RequestStatus.NOT_STARTED) {
|
||||
if (!navigator.onLine) {
|
||||
// Registration required but app is offline.
|
||||
const registrationPromiseWithError = Promise.reject(
|
||||
ERROR_FACTORY.create(ErrorCode.APP_OFFLINE)
|
||||
);
|
||||
return {
|
||||
installationEntry,
|
||||
registrationPromise: registrationPromiseWithError
|
||||
};
|
||||
}
|
||||
|
||||
// Try registering. Change status to IN_PROGRESS.
|
||||
const inProgressEntry: InProgressInstallationEntry = {
|
||||
fid: installationEntry.fid,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: Date.now()
|
||||
};
|
||||
const registrationPromise = registerInstallation(
|
||||
appConfig,
|
||||
inProgressEntry
|
||||
);
|
||||
return { installationEntry: inProgressEntry, registrationPromise };
|
||||
} else if (
|
||||
installationEntry.registrationStatus === RequestStatus.IN_PROGRESS
|
||||
) {
|
||||
return {
|
||||
installationEntry,
|
||||
registrationPromise: waitUntilFidRegistration(appConfig)
|
||||
};
|
||||
} else {
|
||||
return { installationEntry };
|
||||
}
|
||||
}
|
||||
|
||||
/** This will be executed only once for each new Firebase Installation. */
|
||||
async function registerInstallation(
|
||||
appConfig: AppConfig,
|
||||
installationEntry: InProgressInstallationEntry
|
||||
): Promise<RegisteredInstallationEntry> {
|
||||
try {
|
||||
const registeredInstallationEntry = await createInstallation(
|
||||
appConfig,
|
||||
installationEntry
|
||||
);
|
||||
return set(appConfig, registeredInstallationEntry);
|
||||
} catch (e) {
|
||||
if (isServerError(e) && e.serverCode === 409) {
|
||||
// Server returned a "FID can not be used" error.
|
||||
// Generate a new ID next time.
|
||||
await remove(appConfig);
|
||||
} else {
|
||||
// Registration failed. Set FID as not registered.
|
||||
await set(appConfig, {
|
||||
fid: installationEntry.fid,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
});
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/** Call if FID registration is pending. */
|
||||
async function waitUntilFidRegistration(
|
||||
appConfig: AppConfig
|
||||
): Promise<RegisteredInstallationEntry> {
|
||||
// Unfortunately, there is no way of reliably observing when a value in
|
||||
// IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),
|
||||
// so we need to poll.
|
||||
|
||||
let entry: InstallationEntry = await updateInstallationRequest(appConfig);
|
||||
while (entry.registrationStatus === RequestStatus.IN_PROGRESS) {
|
||||
// createInstallation request still in progress.
|
||||
await sleep(100);
|
||||
|
||||
entry = await updateInstallationRequest(appConfig);
|
||||
}
|
||||
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (entry.registrationStatus === RequestStatus.NOT_STARTED) {
|
||||
<span class="cstat-no" title="statement not covered" > throw ERROR_FACTORY.create(ErrorCode.CREATE_INSTALLATION_FAILED);</span>
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called only if there is a CreateInstallation request in progress.
|
||||
*
|
||||
* Updates the InstallationEntry in the DB based on the status of the
|
||||
* CreateInstallation request.
|
||||
*
|
||||
* Returns the updated InstallationEntry.
|
||||
*/
|
||||
function updateInstallationRequest(
|
||||
appConfig: AppConfig
|
||||
): Promise<InstallationEntry> {
|
||||
return update(
|
||||
appConfig,
|
||||
(oldEntry?: InstallationEntry): InstallationEntry => {
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (!oldEntry) {
|
||||
<span class="cstat-no" title="statement not covered" > throw ERROR_FACTORY.create(ErrorCode.INSTALLATION_NOT_FOUND);</span>
|
||||
}
|
||||
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (hasInstallationRequestTimedOut(oldEntry)) {
|
||||
<span class="cstat-no" title="statement not covered" > return {</span>
|
||||
fid: oldEntry.fid,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
};
|
||||
}
|
||||
|
||||
return oldEntry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function hasInstallationRequestTimedOut(
|
||||
installationEntry: InstallationEntry
|
||||
): boolean {
|
||||
return (
|
||||
installationEntry.registrationStatus === RequestStatus.IN_PROGRESS &&
|
||||
installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now()
|
||||
);
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
474
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/idb-manager.test.ts.html
generated
vendored
Normal file
474
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/idb-manager.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,474 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/idb-manager.test.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">helpers</a> idb-manager.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>96/96</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>7/7</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>17/17</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>63/63</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { clear, get, remove, set, update } from './idb-manager';
|
||||
|
||||
describe('idb manager', () => {
|
||||
let appConfig1: AppConfig;
|
||||
let appConfig2: AppConfig;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig1 = { ...getFakeAppConfig(), appName: 'appName1' };
|
||||
appConfig2 = { ...getFakeAppConfig(), appName: 'appName2' };
|
||||
});
|
||||
|
||||
describe('get / set', () => {
|
||||
it('sets a value and then gets the same value back', async () => {
|
||||
await set(appConfig1, 'value');
|
||||
const value = await get(appConfig1);
|
||||
expect(value).to.equal('value');
|
||||
});
|
||||
|
||||
it('gets undefined for a key that does not exist', async () => {
|
||||
const value = await get(appConfig1);
|
||||
expect(value).to.be.undefined;
|
||||
});
|
||||
|
||||
it('sets and gets multiple values with different keys', async () => {
|
||||
await set(appConfig1, 'value');
|
||||
await set(appConfig2, 'value2');
|
||||
expect(await get(appConfig1)).to.equal('value');
|
||||
expect(await get(appConfig2)).to.equal('value2');
|
||||
});
|
||||
|
||||
it('overwrites a value', async () => {
|
||||
await set(appConfig1, 'value');
|
||||
await set(appConfig1, 'newValue');
|
||||
expect(await get(appConfig1)).to.equal('newValue');
|
||||
});
|
||||
});
|
||||
|
||||
describe('remove', () => {
|
||||
it('deletes a key', async () => {
|
||||
await set(appConfig1, 'value');
|
||||
await remove(appConfig1);
|
||||
expect(await get(appConfig1)).to.be.undefined;
|
||||
});
|
||||
|
||||
it('does not throw if key does not exist', async () => {
|
||||
await remove(appConfig1);
|
||||
expect(await get(appConfig1)).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
describe('clear', () => {
|
||||
it('deletes all keys', async () => {
|
||||
await set(appConfig1, 'value');
|
||||
await set(appConfig2, 'value2');
|
||||
await clear();
|
||||
expect(await get(appConfig1)).to.be.undefined;
|
||||
expect(await get(appConfig2)).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
describe('update', () => {
|
||||
it('gets and sets a value atomically, returns the new value', async () => {
|
||||
let isGetCalled = false;
|
||||
|
||||
await set(appConfig1, 'value');
|
||||
|
||||
const resultPromise = update<string, string>(appConfig1, oldValue => {
|
||||
// get is already called for the same key, but it will only complete
|
||||
// after update transaction finishes, at which point it will return the
|
||||
// new value.
|
||||
expect(isGetCalled).to.be.true;
|
||||
|
||||
expect(oldValue).to.equal('value');
|
||||
return 'newValue';
|
||||
});
|
||||
|
||||
// Called immediately after update, but before update completed.
|
||||
const getPromise = get(appConfig1);
|
||||
isGetCalled = true;
|
||||
|
||||
// Update returns the new value
|
||||
expect(await resultPromise).to.equal('newValue');
|
||||
|
||||
// If update weren't atomic, this would return the old value.
|
||||
expect(await getPromise).to.equal('newValue');
|
||||
});
|
||||
|
||||
it('can change the type of the value', async () => {
|
||||
let isGetCalled = false;
|
||||
|
||||
await set(appConfig1, 'value');
|
||||
|
||||
const resultPromise = update<string, number>(appConfig1, oldValue => {
|
||||
// get is already called for the same key, but it will only complete
|
||||
// after update transaction finishes, at which point it will return the
|
||||
// new value.
|
||||
expect(isGetCalled).to.be.true;
|
||||
|
||||
expect(oldValue).to.equal('value');
|
||||
return 123;
|
||||
});
|
||||
|
||||
// Called immediately after update, but before update completed.
|
||||
const getPromise = get(appConfig1);
|
||||
isGetCalled = true;
|
||||
|
||||
// Update returns the new value
|
||||
expect(await resultPromise).to.equal(123);
|
||||
|
||||
// If update weren't atomic, this would return the old value.
|
||||
expect(await getPromise).to.equal(123);
|
||||
});
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
414
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/idb-manager.ts.html
generated
vendored
Normal file
414
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/idb-manager.ts.html
generated
vendored
Normal file
@@ -0,0 +1,414 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/idb-manager.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">helpers</a> idb-manager.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>53/53</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>10/10</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>47/47</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1860x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1860x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">33x</span>
|
||||
<span class="cline-any cline-yes">33x</span>
|
||||
<span class="cline-any cline-yes">33x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">90x</span>
|
||||
<span class="cline-any cline-yes">90x</span>
|
||||
<span class="cline-any cline-yes">90x</span>
|
||||
<span class="cline-any cline-yes">180x</span>
|
||||
<span class="cline-any cline-yes">180x</span>
|
||||
<span class="cline-any cline-yes">90x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-yes">12x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">170x</span>
|
||||
<span class="cline-any cline-yes">170x</span>
|
||||
<span class="cline-any cline-yes">170x</span>
|
||||
<span class="cline-any cline-yes">170x</span>
|
||||
<span class="cline-any cline-yes">170x</span>
|
||||
<span class="cline-any cline-yes">170x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">165x</span>
|
||||
<span class="cline-any cline-yes">123x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">83x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">82x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">84x</span>
|
||||
<span class="cline-any cline-yes">42x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">1561x</span>
|
||||
<span class="cline-any cline-yes">1561x</span>
|
||||
<span class="cline-any cline-yes">3122x</span>
|
||||
<span class="cline-any cline-yes">3122x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">299x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DB, openDb } from 'idb';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
|
||||
const DATABASE_NAME = 'firebase-installations-database';
|
||||
const DATABASE_VERSION = 1;
|
||||
const OBJECT_STORE_NAME = 'firebase-installations-store';
|
||||
|
||||
let dbPromise: Promise<DB> | null = null;
|
||||
function getDbPromise(): Promise<DB> {
|
||||
if (!dbPromise) {
|
||||
dbPromise = openDb(DATABASE_NAME, DATABASE_VERSION, upgradeDB => {
|
||||
// We don't use 'break' in this switch statement, the fall-through
|
||||
// behavior is what we want, because if there are multiple versions between
|
||||
// the old version and the current version, we want ALL the migrations
|
||||
// that correspond to those versions to run, not only the last one.
|
||||
// eslint-disable-next-line default-case
|
||||
switch (upgradeDB.oldVersion) {
|
||||
case 0:
|
||||
upgradeDB.createObjectStore(OBJECT_STORE_NAME);
|
||||
}
|
||||
});
|
||||
}
|
||||
return dbPromise;
|
||||
}
|
||||
|
||||
/** Gets record(s) from the objectStore that match the given key. */
|
||||
export async function get(appConfig: AppConfig): Promise<unknown> {
|
||||
const key = getKey(appConfig);
|
||||
const db = await getDbPromise();
|
||||
return db
|
||||
.transaction(OBJECT_STORE_NAME)
|
||||
.objectStore(OBJECT_STORE_NAME)
|
||||
.get(key);
|
||||
}
|
||||
|
||||
/** Assigns or overwrites the record for the given key with the given value. */
|
||||
export async function set<ValueType>(
|
||||
appConfig: AppConfig,
|
||||
value: ValueType
|
||||
): Promise<ValueType> {
|
||||
const key = getKey(appConfig);
|
||||
const db = await getDbPromise();
|
||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||
await tx.objectStore(OBJECT_STORE_NAME).put(value, key);
|
||||
await tx.complete;
|
||||
return value;
|
||||
}
|
||||
|
||||
/** Removes record(s) from the objectStore that match the given key. */
|
||||
export async function remove(appConfig: AppConfig): Promise<void> {
|
||||
const key = getKey(appConfig);
|
||||
const db = await getDbPromise();
|
||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||
await tx.objectStore(OBJECT_STORE_NAME).delete(key);
|
||||
await tx.complete;
|
||||
}
|
||||
|
||||
/**
|
||||
* Atomically updates a record with the result of updateFn, which gets
|
||||
* called with the current value. If newValue is undefined, the record is
|
||||
* deleted instead.
|
||||
* @return Updated value
|
||||
*/
|
||||
export async function update<OldType, NewType>(
|
||||
appConfig: AppConfig,
|
||||
updateFn: (previousValue: OldType | undefined) => NewType
|
||||
): Promise<NewType> {
|
||||
const key = getKey(appConfig);
|
||||
const db = await getDbPromise();
|
||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||
const store = tx.objectStore(OBJECT_STORE_NAME);
|
||||
const oldValue = await store.get(key);
|
||||
const newValue = updateFn(oldValue);
|
||||
|
||||
if (newValue === oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
if (newValue === undefined) {
|
||||
await store.delete(key);
|
||||
} else {
|
||||
await store.put(newValue, key);
|
||||
}
|
||||
|
||||
await tx.complete;
|
||||
return newValue;
|
||||
}
|
||||
|
||||
export async function clear(): Promise<void> {
|
||||
const db = await getDbPromise();
|
||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||
await tx.objectStore(OBJECT_STORE_NAME).clear();
|
||||
await tx.complete;
|
||||
}
|
||||
|
||||
function getKey(appConfig: AppConfig): string {
|
||||
return `${appConfig.appName}!${appConfig.appId}`;
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
240
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/index.html
generated
vendored
Normal file
240
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/index.html
generated
vendored
Normal file
@@ -0,0 +1,240 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers</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> helpers
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">98.71% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>690/699</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">91.41% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>117/128</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>120/120</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">98.41% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>557/566</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 high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="buffer-to-base64-url-safe.test.ts"><a href="buffer-to-base64-url-safe.test.ts.html">buffer-to-base64-url-safe.test.ts</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="8" class="abs high">8/8</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="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="buffer-to-base64-url-safe.ts"><a href="buffer-to-base64-url-safe.ts.html">buffer-to-base64-url-safe.ts</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="3" class="abs high">3/3</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="1" class="abs high">1/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="3" class="abs high">3/3</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="extract-app-config.test.ts"><a href="extract-app-config.test.ts.html">extract-app-config.test.ts</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="33" class="abs high">33/33</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="9" class="abs high">9/9</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="27" class="abs high">27/27</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="extract-app-config.ts"><a href="extract-app-config.ts.html">extract-app-config.ts</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="12" class="abs high">12/12</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="1" class="abs high">1/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="9" class="abs high">9/9</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="generate-fid.test.ts"><a href="generate-fid.test.ts.html">generate-fid.test.ts</a></td>
|
||||
<td data-value="98" class="pic high"><div class="chart"><div class="cover-fill" style="width: 98%;"></div><div class="cover-empty" style="width:2%;"></div></div></td>
|
||||
<td data-value="98" class="pct high">98%</td>
|
||||
<td data-value="50" class="abs high">49/50</td>
|
||||
<td data-value="83.33" class="pct high">83.33%</td>
|
||||
<td data-value="6" class="abs high">5/6</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
<td data-value="97.78" class="pct high">97.78%</td>
|
||||
<td data-value="45" class="abs high">44/45</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="generate-fid.ts"><a href="generate-fid.ts.html">generate-fid.ts</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="14" class="abs high">14/14</td>
|
||||
<td data-value="50" class="pct medium">50%</td>
|
||||
<td data-value="4" class="abs medium">2/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="14" class="abs high">14/14</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="get-installation-entry.test.ts"><a href="get-installation-entry.test.ts.html">get-installation-entry.test.ts</a></td>
|
||||
<td data-value="99.06" class="pic high"><div class="chart"><div class="cover-fill" style="width: 99%;"></div><div class="cover-empty" style="width:1%;"></div></div></td>
|
||||
<td data-value="99.06" class="pct high">99.06%</td>
|
||||
<td data-value="212" class="abs high">210/212</td>
|
||||
<td data-value="88.89" class="pct high">88.89%</td>
|
||||
<td data-value="18" class="abs high">16/18</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="32" class="abs high">32/32</td>
|
||||
<td data-value="98.79" class="pct high">98.79%</td>
|
||||
<td data-value="165" class="abs high">163/165</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="get-installation-entry.ts"><a href="get-installation-entry.ts.html">get-installation-entry.ts</a></td>
|
||||
<td data-value="94.55" class="pic high"><div class="chart"><div class="cover-fill" style="width: 94%;"></div><div class="cover-empty" style="width:6%;"></div></div></td>
|
||||
<td data-value="94.55" class="pct high">94.55%</td>
|
||||
<td data-value="55" class="abs high">52/55</td>
|
||||
<td data-value="90" class="pct high">90%</td>
|
||||
<td data-value="30" class="abs high">27/30</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="9" class="abs high">9/9</td>
|
||||
<td data-value="93.88" class="pct high">93.88%</td>
|
||||
<td data-value="49" class="abs high">46/49</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="idb-manager.test.ts"><a href="idb-manager.test.ts.html">idb-manager.test.ts</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="96" class="abs high">96/96</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="7" class="abs high">7/7</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="17" class="abs high">17/17</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="63" class="abs high">63/63</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="idb-manager.ts"><a href="idb-manager.ts.html">idb-manager.ts</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="53" class="abs high">53/53</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="47" class="abs high">47/47</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="refresh-auth-token.test.ts"><a href="refresh-auth-token.test.ts.html">refresh-auth-token.test.ts</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="102" class="abs high">102/102</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="9" class="abs high">9/9</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="20" class="abs high">20/20</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="81" class="abs high">81/81</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="refresh-auth-token.ts"><a href="refresh-auth-token.ts.html">refresh-auth-token.ts</a></td>
|
||||
<td data-value="95.08" class="pic high"><div class="chart"><div class="cover-fill" style="width: 95%;"></div><div class="cover-empty" style="width:5%;"></div></div></td>
|
||||
<td data-value="95.08" class="pct high">95.08%</td>
|
||||
<td data-value="61" class="abs high">58/61</td>
|
||||
<td data-value="91.18" class="pct high">91.18%</td>
|
||||
<td data-value="34" class="abs high">31/34</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="11" class="abs high">11/11</td>
|
||||
<td data-value="94.55" class="pct high">94.55%</td>
|
||||
<td data-value="55" class="abs high">52/55</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
693
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/refresh-auth-token.test.ts.html
generated
vendored
Normal file
693
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/refresh-auth-token.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,693 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/refresh-auth-token.test.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">helpers</a> refresh-auth-token.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>102/102</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>9/9</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>20/20</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>81/81</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a>
|
||||
<a name='L137'></a><a href='#L137'>137</a>
|
||||
<a name='L138'></a><a href='#L138'>138</a>
|
||||
<a name='L139'></a><a href='#L139'>139</a>
|
||||
<a name='L140'></a><a href='#L140'>140</a>
|
||||
<a name='L141'></a><a href='#L141'>141</a>
|
||||
<a name='L142'></a><a href='#L142'>142</a>
|
||||
<a name='L143'></a><a href='#L143'>143</a>
|
||||
<a name='L144'></a><a href='#L144'>144</a>
|
||||
<a name='L145'></a><a href='#L145'>145</a>
|
||||
<a name='L146'></a><a href='#L146'>146</a>
|
||||
<a name='L147'></a><a href='#L147'>147</a>
|
||||
<a name='L148'></a><a href='#L148'>148</a>
|
||||
<a name='L149'></a><a href='#L149'>149</a>
|
||||
<a name='L150'></a><a href='#L150'>150</a>
|
||||
<a name='L151'></a><a href='#L151'>151</a>
|
||||
<a name='L152'></a><a href='#L152'>152</a>
|
||||
<a name='L153'></a><a href='#L153'>153</a>
|
||||
<a name='L154'></a><a href='#L154'>154</a>
|
||||
<a name='L155'></a><a href='#L155'>155</a>
|
||||
<a name='L156'></a><a href='#L156'>156</a>
|
||||
<a name='L157'></a><a href='#L157'>157</a>
|
||||
<a name='L158'></a><a href='#L158'>158</a>
|
||||
<a name='L159'></a><a href='#L159'>159</a>
|
||||
<a name='L160'></a><a href='#L160'>160</a>
|
||||
<a name='L161'></a><a href='#L161'>161</a>
|
||||
<a name='L162'></a><a href='#L162'>162</a>
|
||||
<a name='L163'></a><a href='#L163'>163</a>
|
||||
<a name='L164'></a><a href='#L164'>164</a>
|
||||
<a name='L165'></a><a href='#L165'>165</a>
|
||||
<a name='L166'></a><a href='#L166'>166</a>
|
||||
<a name='L167'></a><a href='#L167'>167</a>
|
||||
<a name='L168'></a><a href='#L168'>168</a>
|
||||
<a name='L169'></a><a href='#L169'>169</a>
|
||||
<a name='L170'></a><a href='#L170'>170</a>
|
||||
<a name='L171'></a><a href='#L171'>171</a>
|
||||
<a name='L172'></a><a href='#L172'>172</a>
|
||||
<a name='L173'></a><a href='#L173'>173</a>
|
||||
<a name='L174'></a><a href='#L174'>174</a>
|
||||
<a name='L175'></a><a href='#L175'>175</a>
|
||||
<a name='L176'></a><a href='#L176'>176</a>
|
||||
<a name='L177'></a><a href='#L177'>177</a>
|
||||
<a name='L178'></a><a href='#L178'>178</a>
|
||||
<a name='L179'></a><a href='#L179'>179</a>
|
||||
<a name='L180'></a><a href='#L180'>180</a>
|
||||
<a name='L181'></a><a href='#L181'>181</a>
|
||||
<a name='L182'></a><a href='#L182'>182</a>
|
||||
<a name='L183'></a><a href='#L183'>183</a>
|
||||
<a name='L184'></a><a href='#L184'>184</a>
|
||||
<a name='L185'></a><a href='#L185'>185</a>
|
||||
<a name='L186'></a><a href='#L186'>186</a>
|
||||
<a name='L187'></a><a href='#L187'>187</a>
|
||||
<a name='L188'></a><a href='#L188'>188</a>
|
||||
<a name='L189'></a><a href='#L189'>189</a>
|
||||
<a name='L190'></a><a href='#L190'>190</a>
|
||||
<a name='L191'></a><a href='#L191'>191</a>
|
||||
<a name='L192'></a><a href='#L192'>192</a>
|
||||
<a name='L193'></a><a href='#L193'>193</a>
|
||||
<a name='L194'></a><a href='#L194'>194</a>
|
||||
<a name='L195'></a><a href='#L195'>195</a>
|
||||
<a name='L196'></a><a href='#L196'>196</a>
|
||||
<a name='L197'></a><a href='#L197'>197</a>
|
||||
<a name='L198'></a><a href='#L198'>198</a>
|
||||
<a name='L199'></a><a href='#L199'>199</a>
|
||||
<a name='L200'></a><a href='#L200'>200</a>
|
||||
<a name='L201'></a><a href='#L201'>201</a>
|
||||
<a name='L202'></a><a href='#L202'>202</a>
|
||||
<a name='L203'></a><a href='#L203'>203</a>
|
||||
<a name='L204'></a><a href='#L204'>204</a>
|
||||
<a name='L205'></a><a href='#L205'>205</a>
|
||||
<a name='L206'></a><a href='#L206'>206</a>
|
||||
<a name='L207'></a><a href='#L207'>207</a>
|
||||
<a name='L208'></a><a href='#L208'>208</a>
|
||||
<a name='L209'></a><a href='#L209'>209</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { SinonFakeTimers, SinonStub, stub, useFakeTimers } from 'sinon';
|
||||
import * as generateAuthTokenModule from '../api/generate-auth-token';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
CompletedAuthToken,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus,
|
||||
UnregisteredInstallationEntry
|
||||
} from '../interfaces/installation-entry';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { TOKEN_EXPIRATION_BUFFER } from '../util/constants';
|
||||
import { sleep } from '../util/sleep';
|
||||
import { get, set } from './idb-manager';
|
||||
import { refreshAuthToken } from './refresh-auth-token';
|
||||
|
||||
const FID = 'carry-the-blessed-home';
|
||||
const AUTH_TOKEN = 'authTokenFromServer';
|
||||
const DB_AUTH_TOKEN = 'authTokenFromDB';
|
||||
const ONE_WEEK_MS = 7 * 24 * 60 * 60 * 1000;
|
||||
|
||||
describe('refreshAuthToken', () => {
|
||||
let appConfig: AppConfig;
|
||||
let generateAuthTokenSpy: SinonStub<
|
||||
[AppConfig, RegisteredInstallationEntry],
|
||||
Promise<CompletedAuthToken>
|
||||
>;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = getFakeAppConfig();
|
||||
|
||||
generateAuthTokenSpy = stub(
|
||||
generateAuthTokenModule,
|
||||
'generateAuthToken'
|
||||
).callsFake(async () => {
|
||||
await sleep(100); // Request would take some time
|
||||
const result: CompletedAuthToken = {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
};
|
||||
return result;
|
||||
});
|
||||
});
|
||||
|
||||
it('throws when there is no installation in the DB', async () => {
|
||||
await expect(refreshAuthToken(appConfig)).to.be.rejected;
|
||||
});
|
||||
|
||||
it('throws when there is an unregistered installation in the db', async () => {
|
||||
const installationEntry: UnregisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
};
|
||||
await set(appConfig, installationEntry);
|
||||
|
||||
await expect(refreshAuthToken(appConfig)).to.be.rejected;
|
||||
});
|
||||
|
||||
describe('when there is a valid auth token in the DB', () => {
|
||||
beforeEach(async () => {
|
||||
const installationEntry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, installationEntry);
|
||||
});
|
||||
|
||||
it('returns the token from the DB', async () => {
|
||||
const token = await refreshAuthToken(appConfig);
|
||||
expect(token).to.equal(AUTH_TOKEN);
|
||||
});
|
||||
|
||||
it('does not call any server APIs', async () => {
|
||||
await refreshAuthToken(appConfig);
|
||||
expect(generateAuthTokenSpy).not.to.be.called;
|
||||
});
|
||||
|
||||
it('works even if the app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
const token = await refreshAuthToken(appConfig);
|
||||
expect(token).to.equal(AUTH_TOKEN);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is an auth token that is about to expire in the DB', () => {
|
||||
let clock: SinonFakeTimers;
|
||||
|
||||
beforeEach(async () => {
|
||||
clock = useFakeTimers({ shouldAdvanceTime: true });
|
||||
|
||||
const installationEntry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: DB_AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime:
|
||||
// Expires in ten minutes
|
||||
Date.now() - ONE_WEEK_MS + TOKEN_EXPIRATION_BUFFER + 10 * 60 * 1000
|
||||
}
|
||||
};
|
||||
await set(appConfig, installationEntry);
|
||||
});
|
||||
|
||||
it('returns a different token after expiration', async () => {
|
||||
const token1 = await refreshAuthToken(appConfig);
|
||||
expect(token1).to.equal(DB_AUTH_TOKEN);
|
||||
|
||||
// Wait 30 minutes.
|
||||
clock.tick('30:00');
|
||||
|
||||
const token2 = await refreshAuthToken(appConfig);
|
||||
await expect(token2).to.equal(AUTH_TOKEN);
|
||||
await expect(token2).not.to.equal(DB_AUTH_TOKEN);
|
||||
expect(generateAuthTokenSpy).to.be.calledOnce;
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is an expired auth token in the DB', () => {
|
||||
beforeEach(async () => {
|
||||
const installationEntry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: DB_AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now() - 2 * ONE_WEEK_MS
|
||||
}
|
||||
};
|
||||
await set(appConfig, installationEntry);
|
||||
});
|
||||
|
||||
it('does not call generateAuthToken twice on subsequent calls', async () => {
|
||||
await refreshAuthToken(appConfig);
|
||||
await refreshAuthToken(appConfig);
|
||||
expect(generateAuthTokenSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('does not call generateAuthToken twice on simultaneous calls', async () => {
|
||||
await Promise.all([
|
||||
refreshAuthToken(appConfig),
|
||||
refreshAuthToken(appConfig)
|
||||
]);
|
||||
expect(generateAuthTokenSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('returns a new token', async () => {
|
||||
const token = await refreshAuthToken(appConfig);
|
||||
await expect(token).to.equal(AUTH_TOKEN);
|
||||
await expect(token).not.to.equal(DB_AUTH_TOKEN);
|
||||
expect(generateAuthTokenSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('throws if the app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
await expect(refreshAuthToken(appConfig)).to.be.rejected;
|
||||
});
|
||||
|
||||
it('saves the new token in the DB', async () => {
|
||||
const token = await refreshAuthToken(appConfig);
|
||||
|
||||
const installationEntry = (await get(
|
||||
appConfig
|
||||
)) as RegisteredInstallationEntry;
|
||||
expect(installationEntry).not.to.be.undefined;
|
||||
expect(installationEntry.registrationStatus).to.equal(
|
||||
RequestStatus.COMPLETED
|
||||
);
|
||||
|
||||
const authToken = installationEntry.authToken as CompletedAuthToken;
|
||||
expect(authToken.requestStatus).to.equal(RequestStatus.COMPLETED);
|
||||
expect(authToken.token).to.equal(token);
|
||||
});
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
678
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/refresh-auth-token.ts.html
generated
vendored
Normal file
678
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/helpers/refresh-auth-token.ts.html
generated
vendored
Normal file
@@ -0,0 +1,678 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for helpers/refresh-auth-token.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">helpers</a> refresh-auth-token.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">95.08% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>58/61</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">91.18% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>31/34</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>11/11</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">94.55% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>52/55</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a>
|
||||
<a name='L74'></a><a href='#L74'>74</a>
|
||||
<a name='L75'></a><a href='#L75'>75</a>
|
||||
<a name='L76'></a><a href='#L76'>76</a>
|
||||
<a name='L77'></a><a href='#L77'>77</a>
|
||||
<a name='L78'></a><a href='#L78'>78</a>
|
||||
<a name='L79'></a><a href='#L79'>79</a>
|
||||
<a name='L80'></a><a href='#L80'>80</a>
|
||||
<a name='L81'></a><a href='#L81'>81</a>
|
||||
<a name='L82'></a><a href='#L82'>82</a>
|
||||
<a name='L83'></a><a href='#L83'>83</a>
|
||||
<a name='L84'></a><a href='#L84'>84</a>
|
||||
<a name='L85'></a><a href='#L85'>85</a>
|
||||
<a name='L86'></a><a href='#L86'>86</a>
|
||||
<a name='L87'></a><a href='#L87'>87</a>
|
||||
<a name='L88'></a><a href='#L88'>88</a>
|
||||
<a name='L89'></a><a href='#L89'>89</a>
|
||||
<a name='L90'></a><a href='#L90'>90</a>
|
||||
<a name='L91'></a><a href='#L91'>91</a>
|
||||
<a name='L92'></a><a href='#L92'>92</a>
|
||||
<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>
|
||||
<a name='L98'></a><a href='#L98'>98</a>
|
||||
<a name='L99'></a><a href='#L99'>99</a>
|
||||
<a name='L100'></a><a href='#L100'>100</a>
|
||||
<a name='L101'></a><a href='#L101'>101</a>
|
||||
<a name='L102'></a><a href='#L102'>102</a>
|
||||
<a name='L103'></a><a href='#L103'>103</a>
|
||||
<a name='L104'></a><a href='#L104'>104</a>
|
||||
<a name='L105'></a><a href='#L105'>105</a>
|
||||
<a name='L106'></a><a href='#L106'>106</a>
|
||||
<a name='L107'></a><a href='#L107'>107</a>
|
||||
<a name='L108'></a><a href='#L108'>108</a>
|
||||
<a name='L109'></a><a href='#L109'>109</a>
|
||||
<a name='L110'></a><a href='#L110'>110</a>
|
||||
<a name='L111'></a><a href='#L111'>111</a>
|
||||
<a name='L112'></a><a href='#L112'>112</a>
|
||||
<a name='L113'></a><a href='#L113'>113</a>
|
||||
<a name='L114'></a><a href='#L114'>114</a>
|
||||
<a name='L115'></a><a href='#L115'>115</a>
|
||||
<a name='L116'></a><a href='#L116'>116</a>
|
||||
<a name='L117'></a><a href='#L117'>117</a>
|
||||
<a name='L118'></a><a href='#L118'>118</a>
|
||||
<a name='L119'></a><a href='#L119'>119</a>
|
||||
<a name='L120'></a><a href='#L120'>120</a>
|
||||
<a name='L121'></a><a href='#L121'>121</a>
|
||||
<a name='L122'></a><a href='#L122'>122</a>
|
||||
<a name='L123'></a><a href='#L123'>123</a>
|
||||
<a name='L124'></a><a href='#L124'>124</a>
|
||||
<a name='L125'></a><a href='#L125'>125</a>
|
||||
<a name='L126'></a><a href='#L126'>126</a>
|
||||
<a name='L127'></a><a href='#L127'>127</a>
|
||||
<a name='L128'></a><a href='#L128'>128</a>
|
||||
<a name='L129'></a><a href='#L129'>129</a>
|
||||
<a name='L130'></a><a href='#L130'>130</a>
|
||||
<a name='L131'></a><a href='#L131'>131</a>
|
||||
<a name='L132'></a><a href='#L132'>132</a>
|
||||
<a name='L133'></a><a href='#L133'>133</a>
|
||||
<a name='L134'></a><a href='#L134'>134</a>
|
||||
<a name='L135'></a><a href='#L135'>135</a>
|
||||
<a name='L136'></a><a href='#L136'>136</a>
|
||||
<a name='L137'></a><a href='#L137'>137</a>
|
||||
<a name='L138'></a><a href='#L138'>138</a>
|
||||
<a name='L139'></a><a href='#L139'>139</a>
|
||||
<a name='L140'></a><a href='#L140'>140</a>
|
||||
<a name='L141'></a><a href='#L141'>141</a>
|
||||
<a name='L142'></a><a href='#L142'>142</a>
|
||||
<a name='L143'></a><a href='#L143'>143</a>
|
||||
<a name='L144'></a><a href='#L144'>144</a>
|
||||
<a name='L145'></a><a href='#L145'>145</a>
|
||||
<a name='L146'></a><a href='#L146'>146</a>
|
||||
<a name='L147'></a><a href='#L147'>147</a>
|
||||
<a name='L148'></a><a href='#L148'>148</a>
|
||||
<a name='L149'></a><a href='#L149'>149</a>
|
||||
<a name='L150'></a><a href='#L150'>150</a>
|
||||
<a name='L151'></a><a href='#L151'>151</a>
|
||||
<a name='L152'></a><a href='#L152'>152</a>
|
||||
<a name='L153'></a><a href='#L153'>153</a>
|
||||
<a name='L154'></a><a href='#L154'>154</a>
|
||||
<a name='L155'></a><a href='#L155'>155</a>
|
||||
<a name='L156'></a><a href='#L156'>156</a>
|
||||
<a name='L157'></a><a href='#L157'>157</a>
|
||||
<a name='L158'></a><a href='#L158'>158</a>
|
||||
<a name='L159'></a><a href='#L159'>159</a>
|
||||
<a name='L160'></a><a href='#L160'>160</a>
|
||||
<a name='L161'></a><a href='#L161'>161</a>
|
||||
<a name='L162'></a><a href='#L162'>162</a>
|
||||
<a name='L163'></a><a href='#L163'>163</a>
|
||||
<a name='L164'></a><a href='#L164'>164</a>
|
||||
<a name='L165'></a><a href='#L165'>165</a>
|
||||
<a name='L166'></a><a href='#L166'>166</a>
|
||||
<a name='L167'></a><a href='#L167'>167</a>
|
||||
<a name='L168'></a><a href='#L168'>168</a>
|
||||
<a name='L169'></a><a href='#L169'>169</a>
|
||||
<a name='L170'></a><a href='#L170'>170</a>
|
||||
<a name='L171'></a><a href='#L171'>171</a>
|
||||
<a name='L172'></a><a href='#L172'>172</a>
|
||||
<a name='L173'></a><a href='#L173'>173</a>
|
||||
<a name='L174'></a><a href='#L174'>174</a>
|
||||
<a name='L175'></a><a href='#L175'>175</a>
|
||||
<a name='L176'></a><a href='#L176'>176</a>
|
||||
<a name='L177'></a><a href='#L177'>177</a>
|
||||
<a name='L178'></a><a href='#L178'>178</a>
|
||||
<a name='L179'></a><a href='#L179'>179</a>
|
||||
<a name='L180'></a><a href='#L180'>180</a>
|
||||
<a name='L181'></a><a href='#L181'>181</a>
|
||||
<a name='L182'></a><a href='#L182'>182</a>
|
||||
<a name='L183'></a><a href='#L183'>183</a>
|
||||
<a name='L184'></a><a href='#L184'>184</a>
|
||||
<a name='L185'></a><a href='#L185'>185</a>
|
||||
<a name='L186'></a><a href='#L186'>186</a>
|
||||
<a name='L187'></a><a href='#L187'>187</a>
|
||||
<a name='L188'></a><a href='#L188'>188</a>
|
||||
<a name='L189'></a><a href='#L189'>189</a>
|
||||
<a name='L190'></a><a href='#L190'>190</a>
|
||||
<a name='L191'></a><a href='#L191'>191</a>
|
||||
<a name='L192'></a><a href='#L192'>192</a>
|
||||
<a name='L193'></a><a href='#L193'>193</a>
|
||||
<a name='L194'></a><a href='#L194'>194</a>
|
||||
<a name='L195'></a><a href='#L195'>195</a>
|
||||
<a name='L196'></a><a href='#L196'>196</a>
|
||||
<a name='L197'></a><a href='#L197'>197</a>
|
||||
<a name='L198'></a><a href='#L198'>198</a>
|
||||
<a name='L199'></a><a href='#L199'>199</a>
|
||||
<a name='L200'></a><a href='#L200'>200</a>
|
||||
<a name='L201'></a><a href='#L201'>201</a>
|
||||
<a name='L202'></a><a href='#L202'>202</a>
|
||||
<a name='L203'></a><a href='#L203'>203</a>
|
||||
<a name='L204'></a><a href='#L204'>204</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">55x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">55x</span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">53x</span>
|
||||
<span class="cline-any cline-yes">53x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">27x</span>
|
||||
<span class="cline-any cline-yes">26x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">21x</span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">77x</span>
|
||||
<span class="cline-any cline-yes">46x</span>
|
||||
<span class="cline-any cline-yes">27x</span>
|
||||
<span class="cline-any cline-yes">47x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">34x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">17x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">30x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">2x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">3x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">77x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">53x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">38x</span>
|
||||
<span class="cline-any cline-yes">38x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">18x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">22x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { generateAuthToken } from '../api/generate-auth-token';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
AuthToken,
|
||||
CompletedAuthToken,
|
||||
InProgressAuthToken,
|
||||
InstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { PENDING_TIMEOUT_MS, TOKEN_EXPIRATION_BUFFER } from '../util/constants';
|
||||
import { ERROR_FACTORY, ErrorCode, isServerError } from '../util/errors';
|
||||
import { sleep } from '../util/sleep';
|
||||
import { remove, set, update } from './idb-manager';
|
||||
|
||||
/**
|
||||
* Returns a valid authentication token for the installation. Generates a new
|
||||
* token if one doesn't exist, is expired or about to expire.
|
||||
*
|
||||
* Should only be called if the Firebase Installation is registered.
|
||||
*/
|
||||
export async function refreshAuthToken(appConfig: AppConfig): Promise<string> {
|
||||
let tokenPromise: Promise<CompletedAuthToken> | undefined;
|
||||
const entry = await update(
|
||||
appConfig,
|
||||
(oldEntry?: InstallationEntry): RegisteredInstallationEntry => {
|
||||
if (!isEntryRegistered(oldEntry)) {
|
||||
throw ERROR_FACTORY.create(ErrorCode.NOT_REGISTERED);
|
||||
}
|
||||
|
||||
const oldAuthToken = oldEntry.authToken;
|
||||
if (isAuthTokenValid(oldAuthToken)) {
|
||||
// There is a valid token in the DB.
|
||||
return oldEntry;
|
||||
} else if (oldAuthToken.requestStatus === RequestStatus.IN_PROGRESS) {
|
||||
// There already is a token request in progress.
|
||||
tokenPromise = waitUntilAuthTokenRequest(appConfig);
|
||||
return oldEntry;
|
||||
} else {
|
||||
// No token or token expired.
|
||||
if (!navigator.onLine) {
|
||||
throw ERROR_FACTORY.create(ErrorCode.APP_OFFLINE);
|
||||
}
|
||||
|
||||
const inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);
|
||||
tokenPromise = fetchAuthTokenFromServer(appConfig, inProgressEntry);
|
||||
return inProgressEntry;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const authToken: CompletedAuthToken = tokenPromise
|
||||
? await tokenPromise
|
||||
: (entry.authToken as CompletedAuthToken);
|
||||
return authToken.token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call only if FID is registered and Auth Token request is in progress.
|
||||
*/
|
||||
async function waitUntilAuthTokenRequest(
|
||||
appConfig: AppConfig
|
||||
): Promise<CompletedAuthToken> {
|
||||
// Unfortunately, there is no way of reliably observing when a value in
|
||||
// IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),
|
||||
// so we need to poll.
|
||||
|
||||
let entry = await updateAuthTokenRequest(appConfig);
|
||||
while (entry.authToken.requestStatus === RequestStatus.IN_PROGRESS) {
|
||||
// generateAuthToken still in progress.
|
||||
await sleep(100);
|
||||
|
||||
entry = await updateAuthTokenRequest(appConfig);
|
||||
}
|
||||
|
||||
const authToken = entry.authToken;
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (authToken.requestStatus === RequestStatus.NOT_STARTED) {
|
||||
<span class="cstat-no" title="statement not covered" > throw ERROR_FACTORY.create(ErrorCode.GENERATE_TOKEN_FAILED);</span>
|
||||
} else {
|
||||
return authToken;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called only if there is a GenerateAuthToken request in progress.
|
||||
*
|
||||
* Updates the InstallationEntry in the DB based on the status of the
|
||||
* GenerateAuthToken request.
|
||||
*
|
||||
* Returns the updated InstallationEntry.
|
||||
*/
|
||||
function updateAuthTokenRequest(
|
||||
appConfig: AppConfig
|
||||
): Promise<RegisteredInstallationEntry> {
|
||||
return update(
|
||||
appConfig,
|
||||
(oldEntry?: InstallationEntry): RegisteredInstallationEntry => {
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (!isEntryRegistered(oldEntry)) {
|
||||
<span class="cstat-no" title="statement not covered" > throw ERROR_FACTORY.create(ErrorCode.NOT_REGISTERED);</span>
|
||||
}
|
||||
|
||||
const oldAuthToken = oldEntry.authToken;
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (hasAuthTokenRequestTimedOut(oldAuthToken)) {
|
||||
<span class="cstat-no" title="statement not covered" > return {</span>
|
||||
...oldEntry,
|
||||
authToken: { requestStatus: RequestStatus.NOT_STARTED }
|
||||
};
|
||||
}
|
||||
|
||||
return oldEntry;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
async function fetchAuthTokenFromServer(
|
||||
appConfig: AppConfig,
|
||||
installationEntry: RegisteredInstallationEntry
|
||||
): Promise<CompletedAuthToken> {
|
||||
try {
|
||||
const authToken = await generateAuthToken(appConfig, installationEntry);
|
||||
const updatedInstallationEntry: RegisteredInstallationEntry = {
|
||||
...installationEntry,
|
||||
authToken
|
||||
};
|
||||
await set(appConfig, updatedInstallationEntry);
|
||||
return authToken;
|
||||
} catch (e) {
|
||||
if (isServerError(e) && (e.serverCode === 401 || e.serverCode === 404)) {
|
||||
// Server returned a "FID not found" or a "Invalid authentication" error.
|
||||
// Generate a new ID next time.
|
||||
await remove(appConfig);
|
||||
} else {
|
||||
const updatedInstallationEntry: RegisteredInstallationEntry = {
|
||||
...installationEntry,
|
||||
authToken: { requestStatus: RequestStatus.NOT_STARTED }
|
||||
};
|
||||
await set(appConfig, updatedInstallationEntry);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
function isEntryRegistered(
|
||||
installationEntry: InstallationEntry | undefined
|
||||
): installationEntry is RegisteredInstallationEntry {
|
||||
return (
|
||||
installationEntry !== undefined &&
|
||||
installationEntry.registrationStatus === RequestStatus.COMPLETED
|
||||
);
|
||||
}
|
||||
|
||||
function isAuthTokenValid(authToken: AuthToken): boolean {
|
||||
return (
|
||||
authToken.requestStatus === RequestStatus.COMPLETED &&
|
||||
!isAuthTokenExpired(authToken)
|
||||
);
|
||||
}
|
||||
|
||||
function isAuthTokenExpired(authToken: CompletedAuthToken): boolean {
|
||||
const now = Date.now();
|
||||
return (
|
||||
now < authToken.creationTime ||
|
||||
authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER
|
||||
);
|
||||
}
|
||||
|
||||
/** Returns an updated InstallationEntry with an InProgressAuthToken. */
|
||||
function makeAuthTokenRequestInProgressEntry(
|
||||
oldEntry: RegisteredInstallationEntry
|
||||
): RegisteredInstallationEntry {
|
||||
const inProgressAuthToken: InProgressAuthToken = {
|
||||
requestStatus: RequestStatus.IN_PROGRESS,
|
||||
requestTime: Date.now()
|
||||
};
|
||||
return {
|
||||
...oldEntry,
|
||||
authToken: inProgressAuthToken
|
||||
};
|
||||
}
|
||||
|
||||
function hasAuthTokenRequestTimedOut(authToken: AuthToken): boolean {
|
||||
return (
|
||||
authToken.requestStatus === RequestStatus.IN_PROGRESS &&
|
||||
authToken.requestTime + PENDING_TIMEOUT_MS < Date.now()
|
||||
);
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
149
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/index.html
generated
vendored
Normal file
149
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/index.html
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for All files</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>
|
||||
All files
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">99.02% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>1318/1331</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">92.11% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>175/190</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">98.84% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>255/258</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">98.83% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>1099/1112</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 high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="api"><a href="api/index.html">api</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="251" class="abs high">251/251</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="21" class="abs high">21/21</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="50" class="abs high">50/50</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="217" class="abs high">217/217</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="functions"><a href="functions/index.html">functions</a></td>
|
||||
<td data-value="99.35" class="pic high"><div class="chart"><div class="cover-fill" style="width: 99%;"></div><div class="cover-empty" style="width:1%;"></div></div></td>
|
||||
<td data-value="99.35" class="pct high">99.35%</td>
|
||||
<td data-value="309" class="abs high">307/309</td>
|
||||
<td data-value="91.43" class="pct high">91.43%</td>
|
||||
<td data-value="35" class="abs high">32/35</td>
|
||||
<td data-value="97.18" class="pct high">97.18%</td>
|
||||
<td data-value="71" class="abs high">69/71</td>
|
||||
<td data-value="99.23" class="pct high">99.23%</td>
|
||||
<td data-value="259" class="abs high">257/259</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="helpers"><a href="helpers/index.html">helpers</a></td>
|
||||
<td data-value="98.71" class="pic high"><div class="chart"><div class="cover-fill" style="width: 98%;"></div><div class="cover-empty" style="width:2%;"></div></div></td>
|
||||
<td data-value="98.71" class="pct high">98.71%</td>
|
||||
<td data-value="699" class="abs high">690/699</td>
|
||||
<td data-value="91.41" class="pct high">91.41%</td>
|
||||
<td data-value="128" class="abs high">117/128</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="120" class="abs high">120/120</td>
|
||||
<td data-value="98.41" class="pct high">98.41%</td>
|
||||
<td data-value="566" class="abs high">557/566</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="testing"><a href="testing/index.html">testing</a></td>
|
||||
<td data-value="95.24" class="pic high"><div class="chart"><div class="cover-fill" style="width: 95%;"></div><div class="cover-empty" style="width:5%;"></div></div></td>
|
||||
<td data-value="95.24" class="pct high">95.24%</td>
|
||||
<td data-value="42" class="abs high">40/42</td>
|
||||
<td data-value="75" class="pct medium">75%</td>
|
||||
<td data-value="4" class="abs medium">3/4</td>
|
||||
<td data-value="90.91" class="pct high">90.91%</td>
|
||||
<td data-value="11" class="abs high">10/11</td>
|
||||
<td data-value="95.12" class="pct high">95.12%</td>
|
||||
<td data-value="41" class="abs high">39/41</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="util"><a href="util/index.html">util</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="30" class="abs high">30/30</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</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="29" class="abs high">29/29</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="sorter.js"></script>
|
||||
<script src="block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
2124
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/lcov.info
generated
vendored
Normal file
2124
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/lcov.info
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/prettify.css
generated
vendored
Normal file
1
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/prettify.css
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
||||
2
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/prettify.js
generated
vendored
Normal file
2
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/prettify.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/sort-arrow-sprite.png
generated
vendored
Normal file
BIN
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/sort-arrow-sprite.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 209 B |
170
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/sorter.js
generated
vendored
Normal file
170
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/sorter.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
/* eslint-disable */
|
||||
var addSorting = (function() {
|
||||
'use strict';
|
||||
var cols,
|
||||
currentSort = {
|
||||
index: 0,
|
||||
desc: false
|
||||
};
|
||||
|
||||
// returns the summary table element
|
||||
function getTable() {
|
||||
return document.querySelector('.coverage-summary');
|
||||
}
|
||||
// returns the thead element of the summary table
|
||||
function getTableHeader() {
|
||||
return getTable().querySelector('thead tr');
|
||||
}
|
||||
// returns the tbody element of the summary table
|
||||
function getTableBody() {
|
||||
return getTable().querySelector('tbody');
|
||||
}
|
||||
// returns the th element for nth column
|
||||
function getNthColumn(n) {
|
||||
return getTableHeader().querySelectorAll('th')[n];
|
||||
}
|
||||
|
||||
// loads all columns
|
||||
function loadColumns() {
|
||||
var colNodes = getTableHeader().querySelectorAll('th'),
|
||||
colNode,
|
||||
cols = [],
|
||||
col,
|
||||
i;
|
||||
|
||||
for (i = 0; i < colNodes.length; i += 1) {
|
||||
colNode = colNodes[i];
|
||||
col = {
|
||||
key: colNode.getAttribute('data-col'),
|
||||
sortable: !colNode.getAttribute('data-nosort'),
|
||||
type: colNode.getAttribute('data-type') || 'string'
|
||||
};
|
||||
cols.push(col);
|
||||
if (col.sortable) {
|
||||
col.defaultDescSort = col.type === 'number';
|
||||
colNode.innerHTML =
|
||||
colNode.innerHTML + '<span class="sorter"></span>';
|
||||
}
|
||||
}
|
||||
return cols;
|
||||
}
|
||||
// attaches a data attribute to every tr element with an object
|
||||
// of data values keyed by column name
|
||||
function loadRowData(tableRow) {
|
||||
var tableCols = tableRow.querySelectorAll('td'),
|
||||
colNode,
|
||||
col,
|
||||
data = {},
|
||||
i,
|
||||
val;
|
||||
for (i = 0; i < tableCols.length; i += 1) {
|
||||
colNode = tableCols[i];
|
||||
col = cols[i];
|
||||
val = colNode.getAttribute('data-value');
|
||||
if (col.type === 'number') {
|
||||
val = Number(val);
|
||||
}
|
||||
data[col.key] = val;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
// loads all row data
|
||||
function loadData() {
|
||||
var rows = getTableBody().querySelectorAll('tr'),
|
||||
i;
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
rows[i].data = loadRowData(rows[i]);
|
||||
}
|
||||
}
|
||||
// sorts the table using the data for the ith column
|
||||
function sortByIndex(index, desc) {
|
||||
var key = cols[index].key,
|
||||
sorter = function(a, b) {
|
||||
a = a.data[key];
|
||||
b = b.data[key];
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
},
|
||||
finalSorter = sorter,
|
||||
tableBody = document.querySelector('.coverage-summary tbody'),
|
||||
rowNodes = tableBody.querySelectorAll('tr'),
|
||||
rows = [],
|
||||
i;
|
||||
|
||||
if (desc) {
|
||||
finalSorter = function(a, b) {
|
||||
return -1 * sorter(a, b);
|
||||
};
|
||||
}
|
||||
|
||||
for (i = 0; i < rowNodes.length; i += 1) {
|
||||
rows.push(rowNodes[i]);
|
||||
tableBody.removeChild(rowNodes[i]);
|
||||
}
|
||||
|
||||
rows.sort(finalSorter);
|
||||
|
||||
for (i = 0; i < rows.length; i += 1) {
|
||||
tableBody.appendChild(rows[i]);
|
||||
}
|
||||
}
|
||||
// removes sort indicators for current column being sorted
|
||||
function removeSortIndicators() {
|
||||
var col = getNthColumn(currentSort.index),
|
||||
cls = col.className;
|
||||
|
||||
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
||||
col.className = cls;
|
||||
}
|
||||
// adds sort indicators for current column being sorted
|
||||
function addSortIndicators() {
|
||||
getNthColumn(currentSort.index).className += currentSort.desc
|
||||
? ' sorted-desc'
|
||||
: ' sorted';
|
||||
}
|
||||
// adds event listeners for all sorter widgets
|
||||
function enableUI() {
|
||||
var i,
|
||||
el,
|
||||
ithSorter = function ithSorter(i) {
|
||||
var col = cols[i];
|
||||
|
||||
return function() {
|
||||
var desc = col.defaultDescSort;
|
||||
|
||||
if (currentSort.index === i) {
|
||||
desc = !currentSort.desc;
|
||||
}
|
||||
sortByIndex(i, desc);
|
||||
removeSortIndicators();
|
||||
currentSort.index = i;
|
||||
currentSort.desc = desc;
|
||||
addSortIndicators();
|
||||
};
|
||||
};
|
||||
for (i = 0; i < cols.length; i += 1) {
|
||||
if (cols[i].sortable) {
|
||||
// add the click event handler on the th so users
|
||||
// dont have to click on those tiny arrows
|
||||
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
||||
if (el.addEventListener) {
|
||||
el.addEventListener('click', ithSorter(i));
|
||||
} else {
|
||||
el.attachEvent('onclick', ithSorter(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// adds sorting functionality to the UI
|
||||
return function() {
|
||||
if (!getTable()) {
|
||||
return;
|
||||
}
|
||||
cols = loadColumns();
|
||||
loadData();
|
||||
addSortIndicators();
|
||||
enableUI();
|
||||
};
|
||||
})();
|
||||
|
||||
window.addEventListener('load', addSorting);
|
||||
201
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/compare-headers.test.ts.html
generated
vendored
Normal file
201
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/compare-headers.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for testing/compare-headers.test.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">testing</a> compare-headers.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>18/18</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>18/18</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AssertionError, expect } from 'chai';
|
||||
import '../testing/setup';
|
||||
import { compareHeaders } from './compare-headers';
|
||||
|
||||
describe('compareHeaders', () => {
|
||||
it("doesn't fail if headers contain the same entries", () => {
|
||||
const headers1 = new Headers({ a: '123', b: '456' });
|
||||
const headers2 = new Headers({ a: '123', b: '456' });
|
||||
compareHeaders(headers1, headers2);
|
||||
});
|
||||
|
||||
it('fails if headers contain different keys', () => {
|
||||
const headers1 = new Headers({ a: '123', b: '456', extraKey: '789' });
|
||||
const headers2 = new Headers({ a: '123', b: '456' });
|
||||
expect(() => {
|
||||
compareHeaders(headers1, headers2);
|
||||
}).to.throw(AssertionError);
|
||||
});
|
||||
|
||||
it('fails if headers contain different values', () => {
|
||||
const headers1 = new Headers({ a: '123', b: '456' });
|
||||
const headers2 = new Headers({ a: '123', b: 'differentValue' });
|
||||
expect(() => {
|
||||
compareHeaders(headers1, headers2);
|
||||
}).to.throw(AssertionError);
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
192
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/compare-headers.ts.html
generated
vendored
Normal file
192
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/compare-headers.ts.html
generated
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for testing/compare-headers.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">testing</a> compare-headers.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">85.71% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>6/7</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">75% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>3/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">85.71% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>6/7</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">4x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AssertionError, expect } from 'chai';
|
||||
|
||||
// Trick TS since it's set to target ES5.
|
||||
declare class HeadersWithEntries extends Headers {
|
||||
entries?(): Iterable<[string, string]>;
|
||||
}
|
||||
|
||||
// Chai doesn't check if Headers objects contain the same entries,
|
||||
// so we need to do that manually.
|
||||
export function compareHeaders(
|
||||
expectedHeaders: HeadersWithEntries,
|
||||
actualHeaders: HeadersWithEntries
|
||||
): void {
|
||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (
|
||||
expectedHeaders.entries === undefined ||
|
||||
actualHeaders.entries === undefined
|
||||
) {
|
||||
<span class="cstat-no" title="statement not covered" > throw new AssertionError('Headers object does not have entries method');</span>
|
||||
}
|
||||
|
||||
const expected = new Map(Array.from(expectedHeaders.entries()));
|
||||
const actual = new Map(Array.from(actualHeaders.entries()));
|
||||
expect(actual).to.deep.equal(expected);
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
201
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/get-fake-app.ts.html
generated
vendored
Normal file
201
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/get-fake-app.ts.html
generated
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for testing/get-fake-app.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">testing</a> get-fake-app.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">83.33% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>5/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">66.67% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">83.33% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>5/6</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">114x</span>
|
||||
<span class="cline-any cline-yes">104x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-no"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">10x</span>
|
||||
<span class="cline-any cline-yes">59x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
|
||||
export function getFakeApp(): FirebaseApp {
|
||||
return {
|
||||
name: 'appName',
|
||||
options: {
|
||||
apiKey: 'apiKey',
|
||||
projectId: 'projectId',
|
||||
authDomain: 'authDomain',
|
||||
messagingSenderId: 'messagingSenderId',
|
||||
databaseURL: 'databaseUrl',
|
||||
storageBucket: 'storageBucket',
|
||||
appId: '1:777777777777:web:d93b5ca1475efe57'
|
||||
},
|
||||
automaticDataCollectionEnabled: true,
|
||||
delete: <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >async () => {},</span></span>
|
||||
// This won't be used in tests.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
installations: null as any
|
||||
};
|
||||
}
|
||||
|
||||
export function getFakeAppConfig(): AppConfig {
|
||||
return extractAppConfig(getFakeApp());
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
136
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/index.html
generated
vendored
Normal file
136
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/index.html
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for testing</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> testing
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">95.24% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>40/42</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">75% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>3/4</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">90.91% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>10/11</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">95.12% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>39/41</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 high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="compare-headers.test.ts"><a href="compare-headers.test.ts.html">compare-headers.test.ts</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="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>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="compare-headers.ts"><a href="compare-headers.ts.html">compare-headers.ts</a></td>
|
||||
<td data-value="85.71" class="pic high"><div class="chart"><div class="cover-fill" style="width: 85%;"></div><div class="cover-empty" style="width:15%;"></div></div></td>
|
||||
<td data-value="85.71" class="pct high">85.71%</td>
|
||||
<td data-value="7" class="abs high">6/7</td>
|
||||
<td data-value="75" class="pct medium">75%</td>
|
||||
<td data-value="4" class="abs medium">3/4</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="1" class="abs high">1/1</td>
|
||||
<td data-value="85.71" class="pct high">85.71%</td>
|
||||
<td data-value="7" class="abs high">6/7</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="get-fake-app.ts"><a href="get-fake-app.ts.html">get-fake-app.ts</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="6" class="abs high">5/6</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="0" class="abs high">0/0</td>
|
||||
<td data-value="66.67" class="pct medium">66.67%</td>
|
||||
<td data-value="3" class="abs medium">2/3</td>
|
||||
<td data-value="83.33" class="pct high">83.33%</td>
|
||||
<td data-value="6" class="abs high">5/6</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="setup.ts"><a href="setup.ts.html">setup.ts</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="11" class="abs high">11/11</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="1" class="abs high">1/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="10" class="abs high">10/10</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
159
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/setup.ts.html
generated
vendored
Normal file
159
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/testing/setup.ts.html
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for testing/setup.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">testing</a> setup.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>11/11</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>10/10</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">30x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-yes">15x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1560x</span>
|
||||
<span class="cline-any cline-yes">1560x</span>
|
||||
<span class="cline-any cline-yes">3120x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { use } from 'chai';
|
||||
import * as chaiAsPromised from 'chai-as-promised';
|
||||
import { restore } from 'sinon';
|
||||
import * as sinonChai from 'sinon-chai';
|
||||
import { clear } from '../helpers/idb-manager';
|
||||
|
||||
use(chaiAsPromised);
|
||||
use(sinonChai);
|
||||
|
||||
afterEach(async () => {
|
||||
restore();
|
||||
await clear();
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
162
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/constants.ts.html
generated
vendored
Normal file
162
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/constants.ts.html
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for util/constants.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">util</a> constants.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>8/8</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>8/8</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { version } from '../../package.json';
|
||||
|
||||
export const PENDING_TIMEOUT_MS = 10000;
|
||||
|
||||
export const PACKAGE_VERSION = `w:${version}`;
|
||||
export const INTERNAL_AUTH_VERSION = 'FIS_v2';
|
||||
|
||||
export const INSTALLATIONS_API_URL =
|
||||
'https://firebaseinstallations.googleapis.com/v1';
|
||||
|
||||
export const TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour
|
||||
|
||||
export const SERVICE = 'installations';
|
||||
export const SERVICE_NAME = 'Installations';
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
285
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/errors.ts.html
generated
vendored
Normal file
285
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/errors.ts.html
generated
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for util/errors.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">util</a> errors.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>1/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>6/6</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a>
|
||||
<a name='L39'></a><a href='#L39'>39</a>
|
||||
<a name='L40'></a><a href='#L40'>40</a>
|
||||
<a name='L41'></a><a href='#L41'>41</a>
|
||||
<a name='L42'></a><a href='#L42'>42</a>
|
||||
<a name='L43'></a><a href='#L43'>43</a>
|
||||
<a name='L44'></a><a href='#L44'>44</a>
|
||||
<a name='L45'></a><a href='#L45'>45</a>
|
||||
<a name='L46'></a><a href='#L46'>46</a>
|
||||
<a name='L47'></a><a href='#L47'>47</a>
|
||||
<a name='L48'></a><a href='#L48'>48</a>
|
||||
<a name='L49'></a><a href='#L49'>49</a>
|
||||
<a name='L50'></a><a href='#L50'>50</a>
|
||||
<a name='L51'></a><a href='#L51'>51</a>
|
||||
<a name='L52'></a><a href='#L52'>52</a>
|
||||
<a name='L53'></a><a href='#L53'>53</a>
|
||||
<a name='L54'></a><a href='#L54'>54</a>
|
||||
<a name='L55'></a><a href='#L55'>55</a>
|
||||
<a name='L56'></a><a href='#L56'>56</a>
|
||||
<a name='L57'></a><a href='#L57'>57</a>
|
||||
<a name='L58'></a><a href='#L58'>58</a>
|
||||
<a name='L59'></a><a href='#L59'>59</a>
|
||||
<a name='L60'></a><a href='#L60'>60</a>
|
||||
<a name='L61'></a><a href='#L61'>61</a>
|
||||
<a name='L62'></a><a href='#L62'>62</a>
|
||||
<a name='L63'></a><a href='#L63'>63</a>
|
||||
<a name='L64'></a><a href='#L64'>64</a>
|
||||
<a name='L65'></a><a href='#L65'>65</a>
|
||||
<a name='L66'></a><a href='#L66'>66</a>
|
||||
<a name='L67'></a><a href='#L67'>67</a>
|
||||
<a name='L68'></a><a href='#L68'>68</a>
|
||||
<a name='L69'></a><a href='#L69'>69</a>
|
||||
<a name='L70'></a><a href='#L70'>70</a>
|
||||
<a name='L71'></a><a href='#L71'>71</a>
|
||||
<a name='L72'></a><a href='#L72'>72</a>
|
||||
<a name='L73'></a><a href='#L73'>73</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">11x</span>
|
||||
<span class="cline-any cline-yes">5x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ErrorFactory, FirebaseError } from '@firebase/util';
|
||||
import { SERVICE, SERVICE_NAME } from './constants';
|
||||
|
||||
export const enum ErrorCode {
|
||||
MISSING_APP_CONFIG_VALUES = 'missing-app-config-values',
|
||||
CREATE_INSTALLATION_FAILED = 'create-installation-failed',
|
||||
GENERATE_TOKEN_FAILED = 'generate-token-failed',
|
||||
NOT_REGISTERED = 'not-registered',
|
||||
INSTALLATION_NOT_FOUND = 'installation-not-found',
|
||||
REQUEST_FAILED = 'request-failed',
|
||||
APP_OFFLINE = 'app-offline',
|
||||
DELETE_PENDING_REGISTRATION = 'delete-pending-registration'
|
||||
}
|
||||
|
||||
const ERROR_DESCRIPTION_MAP: { readonly [key in ErrorCode]: string } = {
|
||||
[ErrorCode.MISSING_APP_CONFIG_VALUES]: 'Missing App configuration values.',
|
||||
[ErrorCode.CREATE_INSTALLATION_FAILED]:
|
||||
'Could not register Firebase Installation.',
|
||||
[ErrorCode.GENERATE_TOKEN_FAILED]: 'Could not generate Auth Token.',
|
||||
[ErrorCode.NOT_REGISTERED]: 'Firebase Installation is not registered.',
|
||||
[ErrorCode.INSTALLATION_NOT_FOUND]: 'Firebase Installation not found.',
|
||||
[ErrorCode.REQUEST_FAILED]:
|
||||
'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
|
||||
[ErrorCode.APP_OFFLINE]: 'Could not process request. Application offline.',
|
||||
[ErrorCode.DELETE_PENDING_REGISTRATION]:
|
||||
"Can't delete installation while there is a pending registration request."
|
||||
};
|
||||
|
||||
interface ErrorParams {
|
||||
[ErrorCode.REQUEST_FAILED]: {
|
||||
requestName: string;
|
||||
} & ServerErrorData;
|
||||
}
|
||||
|
||||
export const ERROR_FACTORY = new ErrorFactory<ErrorCode, ErrorParams>(
|
||||
SERVICE,
|
||||
SERVICE_NAME,
|
||||
ERROR_DESCRIPTION_MAP
|
||||
);
|
||||
|
||||
export interface ServerErrorData {
|
||||
serverCode: number;
|
||||
serverMessage: string;
|
||||
serverStatus: string;
|
||||
}
|
||||
|
||||
export type ServerError = FirebaseError & ServerErrorData;
|
||||
|
||||
/** Returns true if error is a FirebaseError that is based on an error from the server. */
|
||||
export function isServerError(error: unknown): error is ServerError {
|
||||
return (
|
||||
error instanceof FirebaseError &&
|
||||
error.code.includes(ErrorCode.REQUEST_FAILED)
|
||||
);
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
136
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/index.html
generated
vendored
Normal file
136
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/index.html
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for util</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> util
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>30/30</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>6/6</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>29/29</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 high'></div>
|
||||
<div class="pad1">
|
||||
<table class="coverage-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
||||
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
||||
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
||||
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
||||
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
||||
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
||||
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><tr>
|
||||
<td class="file high" data-value="constants.ts"><a href="constants.ts.html">constants.ts</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="8" class="abs high">8/8</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="0" class="abs high">0/0</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="8" class="abs high">8/8</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="errors.ts"><a href="errors.ts.html">errors.ts</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="6" class="abs high">6/6</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="1" class="abs high">1/1</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="6" class="abs high">6/6</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="sleep.test.ts"><a href="sleep.test.ts.html">sleep.test.ts</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="13" class="abs high">13/13</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="3" class="abs high">3/3</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="12" class="abs high">12/12</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="file high" data-value="sleep.ts"><a href="sleep.ts.html">sleep.ts</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="3" class="abs high">3/3</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="2" class="abs high">2/2</td>
|
||||
<td data-value="100" class="pct high">100%</td>
|
||||
<td data-value="3" class="abs high">3/3</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div><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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
180
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/sleep.test.ts.html
generated
vendored
Normal file
180
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/sleep.test.ts.html
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for util/sleep.test.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">util</a> sleep.test.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>13/13</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>12/12</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a>
|
||||
<a name='L25'></a><a href='#L25'>25</a>
|
||||
<a name='L26'></a><a href='#L26'>26</a>
|
||||
<a name='L27'></a><a href='#L27'>27</a>
|
||||
<a name='L28'></a><a href='#L28'>28</a>
|
||||
<a name='L29'></a><a href='#L29'>29</a>
|
||||
<a name='L30'></a><a href='#L30'>30</a>
|
||||
<a name='L31'></a><a href='#L31'>31</a>
|
||||
<a name='L32'></a><a href='#L32'>32</a>
|
||||
<a name='L33'></a><a href='#L33'>33</a>
|
||||
<a name='L34'></a><a href='#L34'>34</a>
|
||||
<a name='L35'></a><a href='#L35'>35</a>
|
||||
<a name='L36'></a><a href='#L36'>36</a>
|
||||
<a name='L37'></a><a href='#L37'>37</a>
|
||||
<a name='L38'></a><a href='#L38'>38</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </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">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">1x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { SinonFakeTimers, useFakeTimers } from 'sinon';
|
||||
import '../testing/setup';
|
||||
import { sleep } from './sleep';
|
||||
|
||||
describe('sleep', () => {
|
||||
let clock: SinonFakeTimers;
|
||||
|
||||
beforeEach(() => {
|
||||
clock = useFakeTimers({ shouldAdvanceTime: true });
|
||||
});
|
||||
|
||||
it('returns a promise that resolves after a given amount of time', async () => {
|
||||
const t0 = clock.now;
|
||||
await sleep(100);
|
||||
const t1 = clock.now;
|
||||
|
||||
expect(t1 - t0).to.equal(100);
|
||||
});
|
||||
});
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
138
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/sleep.ts.html
generated
vendored
Normal file
138
node_modules/@firebase/installations/coverage/browser/HeadlessChrome 76.0.3809 (Linux 0.0.0)/util/sleep.ts.html
generated
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for util/sleep.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">util</a> sleep.ts
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>3/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>2/2</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>3/3</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 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>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a>
|
||||
<a name='L13'></a><a href='#L13'>13</a>
|
||||
<a name='L14'></a><a href='#L14'>14</a>
|
||||
<a name='L15'></a><a href='#L15'>15</a>
|
||||
<a name='L16'></a><a href='#L16'>16</a>
|
||||
<a name='L17'></a><a href='#L17'>17</a>
|
||||
<a name='L18'></a><a href='#L18'>18</a>
|
||||
<a name='L19'></a><a href='#L19'>19</a>
|
||||
<a name='L20'></a><a href='#L20'>20</a>
|
||||
<a name='L21'></a><a href='#L21'>21</a>
|
||||
<a name='L22'></a><a href='#L22'>22</a>
|
||||
<a name='L23'></a><a href='#L23'>23</a>
|
||||
<a name='L24'></a><a href='#L24'>24</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-yes">6x</span>
|
||||
<span class="cline-any cline-yes">76x</span>
|
||||
<span class="cline-any cline-yes">76x</span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span>
|
||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** Returns a promise that resolves after given time passes. */
|
||||
export function sleep(ms: number): Promise<void> {
|
||||
return new Promise<void>(resolve => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
</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 Thu Sep 05 2019 16:09:58 GMT-0700 (PDT)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../sorter.js"></script>
|
||||
<script src="../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1129
node_modules/@firebase/installations/dist/index.cjs.js
generated
vendored
Normal file
1129
node_modules/@firebase/installations/dist/index.cjs.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@firebase/installations/dist/index.cjs.js.map
generated
vendored
Normal file
1
node_modules/@firebase/installations/dist/index.cjs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1123
node_modules/@firebase/installations/dist/index.esm.js
generated
vendored
Normal file
1123
node_modules/@firebase/installations/dist/index.esm.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/@firebase/installations/dist/index.esm.js.map
generated
vendored
Normal file
1
node_modules/@firebase/installations/dist/index.esm.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
885
node_modules/@firebase/installations/dist/index.esm2017.js
generated
vendored
Normal file
885
node_modules/@firebase/installations/dist/index.esm2017.js
generated
vendored
Normal file
@@ -0,0 +1,885 @@
|
||||
import firebase from '@firebase/app';
|
||||
import { ErrorFactory, FirebaseError } from '@firebase/util';
|
||||
import { openDb } from 'idb';
|
||||
|
||||
const version = "0.2.6";
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const PENDING_TIMEOUT_MS = 10000;
|
||||
const PACKAGE_VERSION = `w:${version}`;
|
||||
const INTERNAL_AUTH_VERSION = 'FIS_v2';
|
||||
const INSTALLATIONS_API_URL = 'https://firebaseinstallations.googleapis.com/v1';
|
||||
const TOKEN_EXPIRATION_BUFFER = 60 * 60 * 1000; // One hour
|
||||
const SERVICE = 'installations';
|
||||
const SERVICE_NAME = 'Installations';
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const ERROR_DESCRIPTION_MAP = {
|
||||
["missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */]: 'Missing App configuration values.',
|
||||
["create-installation-failed" /* CREATE_INSTALLATION_FAILED */]: 'Could not register Firebase Installation.',
|
||||
["generate-token-failed" /* GENERATE_TOKEN_FAILED */]: 'Could not generate Auth Token.',
|
||||
["not-registered" /* NOT_REGISTERED */]: 'Firebase Installation is not registered.',
|
||||
["installation-not-found" /* INSTALLATION_NOT_FOUND */]: 'Firebase Installation not found.',
|
||||
["request-failed" /* REQUEST_FAILED */]: '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
|
||||
["app-offline" /* APP_OFFLINE */]: 'Could not process request. Application offline.',
|
||||
["delete-pending-registration" /* DELETE_PENDING_REGISTRATION */]: "Can't delete installation while there is a pending registration request."
|
||||
};
|
||||
const ERROR_FACTORY = new ErrorFactory(SERVICE, SERVICE_NAME, ERROR_DESCRIPTION_MAP);
|
||||
/** Returns true if error is a FirebaseError that is based on an error from the server. */
|
||||
function isServerError(error) {
|
||||
return (error instanceof FirebaseError &&
|
||||
error.code.includes("request-failed" /* REQUEST_FAILED */));
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function extractAppConfig(app) {
|
||||
if (!app || !app.options) {
|
||||
throw ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */);
|
||||
}
|
||||
const appName = app.name;
|
||||
const { projectId, apiKey, appId } = app.options;
|
||||
if (!appName || !projectId || !apiKey || !appId) {
|
||||
throw ERROR_FACTORY.create("missing-app-config-values" /* MISSING_APP_CONFIG_VALUES */);
|
||||
}
|
||||
return { appName, projectId, apiKey, appId };
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function getInstallationsEndpoint({ projectId }) {
|
||||
return `${INSTALLATIONS_API_URL}/projects/${projectId}/installations`;
|
||||
}
|
||||
function extractAuthTokenInfoFromResponse(response) {
|
||||
return {
|
||||
token: response.token,
|
||||
requestStatus: 2 /* COMPLETED */,
|
||||
expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),
|
||||
creationTime: Date.now()
|
||||
};
|
||||
}
|
||||
async function getErrorFromResponse(requestName, response) {
|
||||
const responseJson = await response.json();
|
||||
const errorData = responseJson.error;
|
||||
return ERROR_FACTORY.create("request-failed" /* REQUEST_FAILED */, {
|
||||
requestName,
|
||||
serverCode: errorData.code,
|
||||
serverMessage: errorData.message,
|
||||
serverStatus: errorData.status
|
||||
});
|
||||
}
|
||||
function getHeaders({ apiKey }) {
|
||||
return new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
'x-goog-api-key': apiKey
|
||||
});
|
||||
}
|
||||
function getHeadersWithAuth(appConfig, { refreshToken }) {
|
||||
const headers = getHeaders(appConfig);
|
||||
headers.append('Authorization', getAuthorizationHeader(refreshToken));
|
||||
return headers;
|
||||
}
|
||||
/**
|
||||
* Calls the passed in fetch wrapper and returns the response.
|
||||
* If the returned response has a status of 5xx, re-runs the function once and
|
||||
* returns the response.
|
||||
*/
|
||||
async function retryIfServerError(fn) {
|
||||
const result = await fn();
|
||||
if (result.status >= 500 && result.status < 600) {
|
||||
// Internal Server Error. Retry request.
|
||||
return fn();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function getExpiresInFromResponseExpiresIn(responseExpiresIn) {
|
||||
// This works because the server will never respond with fractions of a second.
|
||||
return Number(responseExpiresIn.replace('s', '000'));
|
||||
}
|
||||
function getAuthorizationHeader(refreshToken) {
|
||||
return `${INTERNAL_AUTH_VERSION} ${refreshToken}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
async function createInstallation(appConfig, { fid }) {
|
||||
const endpoint = getInstallationsEndpoint(appConfig);
|
||||
const headers = getHeaders(appConfig);
|
||||
const body = {
|
||||
fid,
|
||||
authVersion: INTERNAL_AUTH_VERSION,
|
||||
appId: appConfig.appId,
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
};
|
||||
const request = {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(body)
|
||||
};
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (response.ok) {
|
||||
const responseValue = await response.json();
|
||||
const registeredInstallationEntry = {
|
||||
fid: responseValue.fid || fid,
|
||||
registrationStatus: 2 /* COMPLETED */,
|
||||
refreshToken: responseValue.refreshToken,
|
||||
authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)
|
||||
};
|
||||
return registeredInstallationEntry;
|
||||
}
|
||||
else {
|
||||
throw await getErrorFromResponse('Create Installation', response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/** Returns a promise that resolves after given time passes. */
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function bufferToBase64UrlSafe(array) {
|
||||
const b64 = btoa(String.fromCharCode(...array));
|
||||
return b64.replace(/\+/g, '-').replace(/\//g, '_');
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const VALID_FID_PATTERN = /^[cdef][\w-]{21}$/;
|
||||
const INVALID_FID = '';
|
||||
/**
|
||||
* Generates a new FID using random values from Web Crypto API.
|
||||
* Returns an empty string if FID generation fails for any reason.
|
||||
*/
|
||||
function generateFid() {
|
||||
try {
|
||||
// A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5
|
||||
// bytes. our implementation generates a 17 byte array instead.
|
||||
const fidByteArray = new Uint8Array(17);
|
||||
const crypto = self.crypto || self.msCrypto;
|
||||
crypto.getRandomValues(fidByteArray);
|
||||
// Replace the first 4 random bits with the constant FID header of 0b0111.
|
||||
fidByteArray[0] = 0b01110000 + (fidByteArray[0] % 0b00010000);
|
||||
const fid = encode(fidByteArray);
|
||||
return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID;
|
||||
}
|
||||
catch (_a) {
|
||||
// FID generation errored
|
||||
return INVALID_FID;
|
||||
}
|
||||
}
|
||||
/** Converts a FID Uint8Array to a base64 string representation. */
|
||||
function encode(fidByteArray) {
|
||||
const b64String = bufferToBase64UrlSafe(fidByteArray);
|
||||
// Remove the 23rd character that was added because of the extra 4 bits at the
|
||||
// end of our 17 byte array, and the '=' padding.
|
||||
return b64String.substr(0, 22);
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
const DATABASE_NAME = 'firebase-installations-database';
|
||||
const DATABASE_VERSION = 1;
|
||||
const OBJECT_STORE_NAME = 'firebase-installations-store';
|
||||
let dbPromise = null;
|
||||
function getDbPromise() {
|
||||
if (!dbPromise) {
|
||||
dbPromise = openDb(DATABASE_NAME, DATABASE_VERSION, upgradeDB => {
|
||||
// We don't use 'break' in this switch statement, the fall-through
|
||||
// behavior is what we want, because if there are multiple versions between
|
||||
// the old version and the current version, we want ALL the migrations
|
||||
// that correspond to those versions to run, not only the last one.
|
||||
// eslint-disable-next-line default-case
|
||||
switch (upgradeDB.oldVersion) {
|
||||
case 0:
|
||||
upgradeDB.createObjectStore(OBJECT_STORE_NAME);
|
||||
}
|
||||
});
|
||||
}
|
||||
return dbPromise;
|
||||
}
|
||||
/** Assigns or overwrites the record for the given key with the given value. */
|
||||
async function set(appConfig, value) {
|
||||
const key = getKey(appConfig);
|
||||
const db = await getDbPromise();
|
||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||
await tx.objectStore(OBJECT_STORE_NAME).put(value, key);
|
||||
await tx.complete;
|
||||
return value;
|
||||
}
|
||||
/** Removes record(s) from the objectStore that match the given key. */
|
||||
async function remove(appConfig) {
|
||||
const key = getKey(appConfig);
|
||||
const db = await getDbPromise();
|
||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||
await tx.objectStore(OBJECT_STORE_NAME).delete(key);
|
||||
await tx.complete;
|
||||
}
|
||||
/**
|
||||
* Atomically updates a record with the result of updateFn, which gets
|
||||
* called with the current value. If newValue is undefined, the record is
|
||||
* deleted instead.
|
||||
* @return Updated value
|
||||
*/
|
||||
async function update(appConfig, updateFn) {
|
||||
const key = getKey(appConfig);
|
||||
const db = await getDbPromise();
|
||||
const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
|
||||
const store = tx.objectStore(OBJECT_STORE_NAME);
|
||||
const oldValue = await store.get(key);
|
||||
const newValue = updateFn(oldValue);
|
||||
if (newValue === oldValue) {
|
||||
return newValue;
|
||||
}
|
||||
if (newValue === undefined) {
|
||||
await store.delete(key);
|
||||
}
|
||||
else {
|
||||
await store.put(newValue, key);
|
||||
}
|
||||
await tx.complete;
|
||||
return newValue;
|
||||
}
|
||||
function getKey(appConfig) {
|
||||
return `${appConfig.appName}!${appConfig.appId}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Updates and returns the InstallationEntry from the database.
|
||||
* Also triggers a registration request if it is necessary and possible.
|
||||
*/
|
||||
async function getInstallationEntry(appConfig) {
|
||||
let registrationPromise;
|
||||
const installationEntry = await update(appConfig, (oldEntry) => {
|
||||
const installationEntry = updateOrCreateInstallationEntry(oldEntry);
|
||||
const entryWithPromise = triggerRegistrationIfNecessary(appConfig, installationEntry);
|
||||
registrationPromise = entryWithPromise.registrationPromise;
|
||||
return entryWithPromise.installationEntry;
|
||||
});
|
||||
if (installationEntry.fid === INVALID_FID) {
|
||||
// FID generation failed. Waiting for the FID from the server.
|
||||
return { installationEntry: await registrationPromise };
|
||||
}
|
||||
return {
|
||||
installationEntry,
|
||||
registrationPromise
|
||||
};
|
||||
}
|
||||
function updateOrCreateInstallationEntry(oldEntry) {
|
||||
const entry = oldEntry || {
|
||||
fid: generateFid(),
|
||||
registrationStatus: 0 /* NOT_STARTED */
|
||||
};
|
||||
if (hasInstallationRequestTimedOut(entry)) {
|
||||
return {
|
||||
fid: entry.fid,
|
||||
registrationStatus: 0 /* NOT_STARTED */
|
||||
};
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
/**
|
||||
* If the Firebase Installation is not registered yet, this will trigger the registration
|
||||
* and return an InProgressInstallationEntry.
|
||||
*/
|
||||
function triggerRegistrationIfNecessary(appConfig, installationEntry) {
|
||||
if (installationEntry.registrationStatus === 0 /* NOT_STARTED */) {
|
||||
if (!navigator.onLine) {
|
||||
// Registration required but app is offline.
|
||||
const registrationPromiseWithError = Promise.reject(ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */));
|
||||
return {
|
||||
installationEntry,
|
||||
registrationPromise: registrationPromiseWithError
|
||||
};
|
||||
}
|
||||
// Try registering. Change status to IN_PROGRESS.
|
||||
const inProgressEntry = {
|
||||
fid: installationEntry.fid,
|
||||
registrationStatus: 1 /* IN_PROGRESS */,
|
||||
registrationTime: Date.now()
|
||||
};
|
||||
const registrationPromise = registerInstallation(appConfig, inProgressEntry);
|
||||
return { installationEntry: inProgressEntry, registrationPromise };
|
||||
}
|
||||
else if (installationEntry.registrationStatus === 1 /* IN_PROGRESS */) {
|
||||
return {
|
||||
installationEntry,
|
||||
registrationPromise: waitUntilFidRegistration(appConfig)
|
||||
};
|
||||
}
|
||||
else {
|
||||
return { installationEntry };
|
||||
}
|
||||
}
|
||||
/** This will be executed only once for each new Firebase Installation. */
|
||||
async function registerInstallation(appConfig, installationEntry) {
|
||||
try {
|
||||
const registeredInstallationEntry = await createInstallation(appConfig, installationEntry);
|
||||
return set(appConfig, registeredInstallationEntry);
|
||||
}
|
||||
catch (e) {
|
||||
if (isServerError(e) && e.serverCode === 409) {
|
||||
// Server returned a "FID can not be used" error.
|
||||
// Generate a new ID next time.
|
||||
await remove(appConfig);
|
||||
}
|
||||
else {
|
||||
// Registration failed. Set FID as not registered.
|
||||
await set(appConfig, {
|
||||
fid: installationEntry.fid,
|
||||
registrationStatus: 0 /* NOT_STARTED */
|
||||
});
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/** Call if FID registration is pending. */
|
||||
async function waitUntilFidRegistration(appConfig) {
|
||||
// Unfortunately, there is no way of reliably observing when a value in
|
||||
// IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),
|
||||
// so we need to poll.
|
||||
let entry = await updateInstallationRequest(appConfig);
|
||||
while (entry.registrationStatus === 1 /* IN_PROGRESS */) {
|
||||
// createInstallation request still in progress.
|
||||
await sleep(100);
|
||||
entry = await updateInstallationRequest(appConfig);
|
||||
}
|
||||
if (entry.registrationStatus === 0 /* NOT_STARTED */) {
|
||||
throw ERROR_FACTORY.create("create-installation-failed" /* CREATE_INSTALLATION_FAILED */);
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
/**
|
||||
* Called only if there is a CreateInstallation request in progress.
|
||||
*
|
||||
* Updates the InstallationEntry in the DB based on the status of the
|
||||
* CreateInstallation request.
|
||||
*
|
||||
* Returns the updated InstallationEntry.
|
||||
*/
|
||||
function updateInstallationRequest(appConfig) {
|
||||
return update(appConfig, (oldEntry) => {
|
||||
if (!oldEntry) {
|
||||
throw ERROR_FACTORY.create("installation-not-found" /* INSTALLATION_NOT_FOUND */);
|
||||
}
|
||||
if (hasInstallationRequestTimedOut(oldEntry)) {
|
||||
return {
|
||||
fid: oldEntry.fid,
|
||||
registrationStatus: 0 /* NOT_STARTED */
|
||||
};
|
||||
}
|
||||
return oldEntry;
|
||||
});
|
||||
}
|
||||
function hasInstallationRequestTimedOut(installationEntry) {
|
||||
return (installationEntry.registrationStatus === 1 /* IN_PROGRESS */ &&
|
||||
installationEntry.registrationTime + PENDING_TIMEOUT_MS < Date.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
async function generateAuthToken(appConfig, installationEntry) {
|
||||
const endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry);
|
||||
const headers = getHeadersWithAuth(appConfig, installationEntry);
|
||||
const body = {
|
||||
installation: {
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
}
|
||||
};
|
||||
const request = {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(body)
|
||||
};
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (response.ok) {
|
||||
const responseValue = await response.json();
|
||||
const completedAuthToken = extractAuthTokenInfoFromResponse(responseValue);
|
||||
return completedAuthToken;
|
||||
}
|
||||
else {
|
||||
throw await getErrorFromResponse('Generate Auth Token', response);
|
||||
}
|
||||
}
|
||||
function getGenerateAuthTokenEndpoint(appConfig, { fid }) {
|
||||
return `${getInstallationsEndpoint(appConfig)}/${fid}/authTokens:generate`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/**
|
||||
* Returns a valid authentication token for the installation. Generates a new
|
||||
* token if one doesn't exist, is expired or about to expire.
|
||||
*
|
||||
* Should only be called if the Firebase Installation is registered.
|
||||
*/
|
||||
async function refreshAuthToken(appConfig) {
|
||||
let tokenPromise;
|
||||
const entry = await update(appConfig, (oldEntry) => {
|
||||
if (!isEntryRegistered(oldEntry)) {
|
||||
throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */);
|
||||
}
|
||||
const oldAuthToken = oldEntry.authToken;
|
||||
if (isAuthTokenValid(oldAuthToken)) {
|
||||
// There is a valid token in the DB.
|
||||
return oldEntry;
|
||||
}
|
||||
else if (oldAuthToken.requestStatus === 1 /* IN_PROGRESS */) {
|
||||
// There already is a token request in progress.
|
||||
tokenPromise = waitUntilAuthTokenRequest(appConfig);
|
||||
return oldEntry;
|
||||
}
|
||||
else {
|
||||
// No token or token expired.
|
||||
if (!navigator.onLine) {
|
||||
throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */);
|
||||
}
|
||||
const inProgressEntry = makeAuthTokenRequestInProgressEntry(oldEntry);
|
||||
tokenPromise = fetchAuthTokenFromServer(appConfig, inProgressEntry);
|
||||
return inProgressEntry;
|
||||
}
|
||||
});
|
||||
const authToken = tokenPromise
|
||||
? await tokenPromise
|
||||
: entry.authToken;
|
||||
return authToken.token;
|
||||
}
|
||||
/**
|
||||
* Call only if FID is registered and Auth Token request is in progress.
|
||||
*/
|
||||
async function waitUntilAuthTokenRequest(appConfig) {
|
||||
// Unfortunately, there is no way of reliably observing when a value in
|
||||
// IndexedDB changes (yet, see https://github.com/WICG/indexed-db-observers),
|
||||
// so we need to poll.
|
||||
let entry = await updateAuthTokenRequest(appConfig);
|
||||
while (entry.authToken.requestStatus === 1 /* IN_PROGRESS */) {
|
||||
// generateAuthToken still in progress.
|
||||
await sleep(100);
|
||||
entry = await updateAuthTokenRequest(appConfig);
|
||||
}
|
||||
const authToken = entry.authToken;
|
||||
if (authToken.requestStatus === 0 /* NOT_STARTED */) {
|
||||
throw ERROR_FACTORY.create("generate-token-failed" /* GENERATE_TOKEN_FAILED */);
|
||||
}
|
||||
else {
|
||||
return authToken;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Called only if there is a GenerateAuthToken request in progress.
|
||||
*
|
||||
* Updates the InstallationEntry in the DB based on the status of the
|
||||
* GenerateAuthToken request.
|
||||
*
|
||||
* Returns the updated InstallationEntry.
|
||||
*/
|
||||
function updateAuthTokenRequest(appConfig) {
|
||||
return update(appConfig, (oldEntry) => {
|
||||
if (!isEntryRegistered(oldEntry)) {
|
||||
throw ERROR_FACTORY.create("not-registered" /* NOT_REGISTERED */);
|
||||
}
|
||||
const oldAuthToken = oldEntry.authToken;
|
||||
if (hasAuthTokenRequestTimedOut(oldAuthToken)) {
|
||||
return Object.assign({}, oldEntry, { authToken: { requestStatus: 0 /* NOT_STARTED */ } });
|
||||
}
|
||||
return oldEntry;
|
||||
});
|
||||
}
|
||||
async function fetchAuthTokenFromServer(appConfig, installationEntry) {
|
||||
try {
|
||||
const authToken = await generateAuthToken(appConfig, installationEntry);
|
||||
const updatedInstallationEntry = Object.assign({}, installationEntry, { authToken });
|
||||
await set(appConfig, updatedInstallationEntry);
|
||||
return authToken;
|
||||
}
|
||||
catch (e) {
|
||||
if (isServerError(e) && (e.serverCode === 401 || e.serverCode === 404)) {
|
||||
// Server returned a "FID not found" or a "Invalid authentication" error.
|
||||
// Generate a new ID next time.
|
||||
await remove(appConfig);
|
||||
}
|
||||
else {
|
||||
const updatedInstallationEntry = Object.assign({}, installationEntry, { authToken: { requestStatus: 0 /* NOT_STARTED */ } });
|
||||
await set(appConfig, updatedInstallationEntry);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function isEntryRegistered(installationEntry) {
|
||||
return (installationEntry !== undefined &&
|
||||
installationEntry.registrationStatus === 2 /* COMPLETED */);
|
||||
}
|
||||
function isAuthTokenValid(authToken) {
|
||||
return (authToken.requestStatus === 2 /* COMPLETED */ &&
|
||||
!isAuthTokenExpired(authToken));
|
||||
}
|
||||
function isAuthTokenExpired(authToken) {
|
||||
const now = Date.now();
|
||||
return (now < authToken.creationTime ||
|
||||
authToken.creationTime + authToken.expiresIn < now + TOKEN_EXPIRATION_BUFFER);
|
||||
}
|
||||
/** Returns an updated InstallationEntry with an InProgressAuthToken. */
|
||||
function makeAuthTokenRequestInProgressEntry(oldEntry) {
|
||||
const inProgressAuthToken = {
|
||||
requestStatus: 1 /* IN_PROGRESS */,
|
||||
requestTime: Date.now()
|
||||
};
|
||||
return Object.assign({}, oldEntry, { authToken: inProgressAuthToken });
|
||||
}
|
||||
function hasAuthTokenRequestTimedOut(authToken) {
|
||||
return (authToken.requestStatus === 1 /* IN_PROGRESS */ &&
|
||||
authToken.requestTime + PENDING_TIMEOUT_MS < Date.now());
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
async function getId(app) {
|
||||
const appConfig = extractAppConfig(app);
|
||||
const { installationEntry, registrationPromise } = await getInstallationEntry(appConfig);
|
||||
if (registrationPromise) {
|
||||
// Suppress registration errors as they are not a problem for getId.
|
||||
registrationPromise.catch(() => { });
|
||||
}
|
||||
if (installationEntry.registrationStatus === 2 /* COMPLETED */) {
|
||||
// If the installation is already registered, update the authentication
|
||||
// token if needed. Suppress errors as they are not relevant to getId.
|
||||
refreshAuthToken(appConfig).catch(() => { });
|
||||
}
|
||||
return installationEntry.fid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
async function getToken(app) {
|
||||
const appConfig = extractAppConfig(app);
|
||||
await completeInstallationRegistration(appConfig);
|
||||
// At this point we either have a Registered Installation in the DB, or we've
|
||||
// already thrown an error.
|
||||
return refreshAuthToken(appConfig);
|
||||
}
|
||||
async function completeInstallationRegistration(appConfig) {
|
||||
const { installationEntry, registrationPromise } = await getInstallationEntry(appConfig);
|
||||
if (registrationPromise) {
|
||||
// A createInstallation request is in progress. Wait until it finishes.
|
||||
await registrationPromise;
|
||||
}
|
||||
else if (installationEntry.registrationStatus !== 2 /* COMPLETED */) {
|
||||
// Installation ID can't be registered.
|
||||
throw ERROR_FACTORY.create("create-installation-failed" /* CREATE_INSTALLATION_FAILED */);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
async function deleteInstallation(appConfig, installationEntry) {
|
||||
const endpoint = getDeleteEndpoint(appConfig, installationEntry);
|
||||
const headers = getHeadersWithAuth(appConfig, installationEntry);
|
||||
const request = {
|
||||
method: 'DELETE',
|
||||
headers
|
||||
};
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (!response.ok) {
|
||||
throw await getErrorFromResponse('Delete Installation', response);
|
||||
}
|
||||
}
|
||||
function getDeleteEndpoint(appConfig, { fid }) {
|
||||
return `${getInstallationsEndpoint(appConfig)}/${fid}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
async function deleteInstallation$1(app) {
|
||||
const appConfig = extractAppConfig(app);
|
||||
const entry = await update(appConfig, (oldEntry) => {
|
||||
if (oldEntry && oldEntry.registrationStatus === 0 /* NOT_STARTED */) {
|
||||
// Delete the unregistered entry without sending a deleteInstallation request.
|
||||
return undefined;
|
||||
}
|
||||
return oldEntry;
|
||||
});
|
||||
if (entry) {
|
||||
if (entry.registrationStatus === 1 /* IN_PROGRESS */) {
|
||||
// Can't delete while trying to register.
|
||||
throw ERROR_FACTORY.create("delete-pending-registration" /* DELETE_PENDING_REGISTRATION */);
|
||||
}
|
||||
else if (entry.registrationStatus === 2 /* COMPLETED */) {
|
||||
if (!navigator.onLine) {
|
||||
throw ERROR_FACTORY.create("app-offline" /* APP_OFFLINE */);
|
||||
}
|
||||
else {
|
||||
await deleteInstallation(appConfig, entry);
|
||||
await remove(appConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
function registerInstallations(instance) {
|
||||
const installationsName = 'installations';
|
||||
const factoryMethod = app => {
|
||||
// Throws if app isn't configured properly.
|
||||
extractAppConfig(app);
|
||||
return {
|
||||
app,
|
||||
getId: () => getId(app),
|
||||
getToken: () => getToken(app),
|
||||
delete: () => deleteInstallation$1(app)
|
||||
};
|
||||
};
|
||||
instance.INTERNAL.registerService(installationsName, factoryMethod);
|
||||
}
|
||||
registerInstallations(firebase);
|
||||
|
||||
export { registerInstallations };
|
||||
//# sourceMappingURL=index.esm2017.js.map
|
||||
1
node_modules/@firebase/installations/dist/index.esm2017.js.map
generated
vendored
Normal file
1
node_modules/@firebase/installations/dist/index.esm2017.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
38
node_modules/@firebase/installations/dist/src/api/common.d.ts
generated
vendored
Normal file
38
node_modules/@firebase/installations/dist/src/api/common.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { GenerateAuthTokenResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { CompletedAuthToken, RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
||||
export declare function getInstallationsEndpoint({ projectId }: AppConfig): string;
|
||||
export declare function extractAuthTokenInfoFromResponse(response: GenerateAuthTokenResponse): CompletedAuthToken;
|
||||
export declare function getErrorFromResponse(requestName: string, response: Response): Promise<FirebaseError>;
|
||||
export declare function getHeaders({ apiKey }: AppConfig): Headers;
|
||||
export declare function getHeadersWithAuth(appConfig: AppConfig, { refreshToken }: RegisteredInstallationEntry): Headers;
|
||||
export interface ErrorResponse {
|
||||
error: {
|
||||
code: number;
|
||||
message: string;
|
||||
status: string;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Calls the passed in fetch wrapper and returns the response.
|
||||
* If the returned response has a status of 5xx, re-runs the function once and
|
||||
* returns the response.
|
||||
*/
|
||||
export declare function retryIfServerError(fn: () => Promise<Response>): Promise<Response>;
|
||||
19
node_modules/@firebase/installations/dist/src/api/create-installation.d.ts
generated
vendored
Normal file
19
node_modules/@firebase/installations/dist/src/api/create-installation.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { InProgressInstallationEntry, RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
||||
export declare function createInstallation(appConfig: AppConfig, { fid }: InProgressInstallationEntry): Promise<RegisteredInstallationEntry>;
|
||||
19
node_modules/@firebase/installations/dist/src/api/delete-installation.d.ts
generated
vendored
Normal file
19
node_modules/@firebase/installations/dist/src/api/delete-installation.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
||||
export declare function deleteInstallation(appConfig: AppConfig, installationEntry: RegisteredInstallationEntry): Promise<void>;
|
||||
19
node_modules/@firebase/installations/dist/src/api/generate-auth-token.d.ts
generated
vendored
Normal file
19
node_modules/@firebase/installations/dist/src/api/generate-auth-token.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { CompletedAuthToken, RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
||||
export declare function generateAuthToken(appConfig: AppConfig, installationEntry: RegisteredInstallationEntry): Promise<CompletedAuthToken>;
|
||||
18
node_modules/@firebase/installations/dist/src/functions/delete-installation.d.ts
generated
vendored
Normal file
18
node_modules/@firebase/installations/dist/src/functions/delete-installation.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
export declare function deleteInstallation(app: FirebaseApp): Promise<void>;
|
||||
18
node_modules/@firebase/installations/dist/src/functions/get-id.d.ts
generated
vendored
Normal file
18
node_modules/@firebase/installations/dist/src/functions/get-id.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
export declare function getId(app: FirebaseApp): Promise<string>;
|
||||
18
node_modules/@firebase/installations/dist/src/functions/get-token.d.ts
generated
vendored
Normal file
18
node_modules/@firebase/installations/dist/src/functions/get-token.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
export declare function getToken(app: FirebaseApp): Promise<string>;
|
||||
19
node_modules/@firebase/installations/dist/src/functions/index.d.ts
generated
vendored
Normal file
19
node_modules/@firebase/installations/dist/src/functions/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export { getId } from './get-id';
|
||||
export { getToken } from './get-token';
|
||||
export { deleteInstallation } from './delete-installation';
|
||||
17
node_modules/@firebase/installations/dist/src/helpers/buffer-to-base64-url-safe.d.ts
generated
vendored
Normal file
17
node_modules/@firebase/installations/dist/src/helpers/buffer-to-base64-url-safe.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export declare function bufferToBase64UrlSafe(array: Uint8Array): string;
|
||||
19
node_modules/@firebase/installations/dist/src/helpers/extract-app-config.d.ts
generated
vendored
Normal file
19
node_modules/@firebase/installations/dist/src/helpers/extract-app-config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
export declare function extractAppConfig(app: FirebaseApp): AppConfig;
|
||||
23
node_modules/@firebase/installations/dist/src/helpers/generate-fid.d.ts
generated
vendored
Normal file
23
node_modules/@firebase/installations/dist/src/helpers/generate-fid.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export declare const VALID_FID_PATTERN: RegExp;
|
||||
export declare const INVALID_FID = "";
|
||||
/**
|
||||
* Generates a new FID using random values from Web Crypto API.
|
||||
* Returns an empty string if FID generation fails for any reason.
|
||||
*/
|
||||
export declare function generateFid(): string;
|
||||
27
node_modules/@firebase/installations/dist/src/helpers/get-installation-entry.d.ts
generated
vendored
Normal file
27
node_modules/@firebase/installations/dist/src/helpers/get-installation-entry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { InstallationEntry, RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
||||
export interface InstallationEntryWithRegistrationPromise {
|
||||
installationEntry: InstallationEntry;
|
||||
registrationPromise?: Promise<RegisteredInstallationEntry>;
|
||||
}
|
||||
/**
|
||||
* Updates and returns the InstallationEntry from the database.
|
||||
* Also triggers a registration request if it is necessary and possible.
|
||||
*/
|
||||
export declare function getInstallationEntry(appConfig: AppConfig): Promise<InstallationEntryWithRegistrationPromise>;
|
||||
31
node_modules/@firebase/installations/dist/src/helpers/idb-manager.d.ts
generated
vendored
Normal file
31
node_modules/@firebase/installations/dist/src/helpers/idb-manager.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
/** Gets record(s) from the objectStore that match the given key. */
|
||||
export declare function get(appConfig: AppConfig): Promise<unknown>;
|
||||
/** Assigns or overwrites the record for the given key with the given value. */
|
||||
export declare function set<ValueType>(appConfig: AppConfig, value: ValueType): Promise<ValueType>;
|
||||
/** Removes record(s) from the objectStore that match the given key. */
|
||||
export declare function remove(appConfig: AppConfig): Promise<void>;
|
||||
/**
|
||||
* Atomically updates a record with the result of updateFn, which gets
|
||||
* called with the current value. If newValue is undefined, the record is
|
||||
* deleted instead.
|
||||
* @return Updated value
|
||||
*/
|
||||
export declare function update<OldType, NewType>(appConfig: AppConfig, updateFn: (previousValue: OldType | undefined) => NewType): Promise<NewType>;
|
||||
export declare function clear(): Promise<void>;
|
||||
24
node_modules/@firebase/installations/dist/src/helpers/refresh-auth-token.d.ts
generated
vendored
Normal file
24
node_modules/@firebase/installations/dist/src/helpers/refresh-auth-token.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
/**
|
||||
* Returns a valid authentication token for the installation. Generates a new
|
||||
* token if one doesn't exist, is expired or about to expire.
|
||||
*
|
||||
* Should only be called if the Firebase Installation is registered.
|
||||
*/
|
||||
export declare function refreshAuthToken(appConfig: AppConfig): Promise<string>;
|
||||
30
node_modules/@firebase/installations/dist/src/index.d.ts
generated
vendored
Normal file
30
node_modules/@firebase/installations/dist/src/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { _FirebaseNamespace } from '@firebase/app-types/private';
|
||||
import { FirebaseInstallations } from '@firebase/installations-types';
|
||||
export declare function registerInstallations(instance: _FirebaseNamespace): void;
|
||||
/**
|
||||
* Define extension behavior of `registerInstallations`
|
||||
*/
|
||||
declare module '@firebase/app-types' {
|
||||
interface FirebaseNamespace {
|
||||
installations(app?: FirebaseApp): FirebaseInstallations;
|
||||
}
|
||||
interface FirebaseApp {
|
||||
installations(): FirebaseInstallations;
|
||||
}
|
||||
}
|
||||
31
node_modules/@firebase/installations/dist/src/interfaces/api-response.d.ts
generated
vendored
Normal file
31
node_modules/@firebase/installations/dist/src/interfaces/api-response.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export interface CreateInstallationResponse {
|
||||
readonly refreshToken: string;
|
||||
readonly authToken: GenerateAuthTokenResponse;
|
||||
readonly fid?: string;
|
||||
}
|
||||
export interface GenerateAuthTokenResponse {
|
||||
readonly token: string;
|
||||
/**
|
||||
* Encoded as a string with the suffix 's' (indicating seconds), preceded by
|
||||
* the number of seconds.
|
||||
*
|
||||
* Example: "604800s".
|
||||
*/
|
||||
readonly expiresIn: string;
|
||||
}
|
||||
22
node_modules/@firebase/installations/dist/src/interfaces/app-config.d.ts
generated
vendored
Normal file
22
node_modules/@firebase/installations/dist/src/interfaces/app-config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export interface AppConfig {
|
||||
readonly appName: string;
|
||||
readonly projectId: string;
|
||||
readonly apiKey: string;
|
||||
readonly appId: string;
|
||||
}
|
||||
85
node_modules/@firebase/installations/dist/src/interfaces/installation-entry.d.ts
generated
vendored
Normal file
85
node_modules/@firebase/installations/dist/src/interfaces/installation-entry.d.ts
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/** Status of a server request. */
|
||||
export declare const enum RequestStatus {
|
||||
NOT_STARTED = 0,
|
||||
IN_PROGRESS = 1,
|
||||
COMPLETED = 2
|
||||
}
|
||||
export interface NotStartedAuthToken {
|
||||
readonly requestStatus: RequestStatus.NOT_STARTED;
|
||||
}
|
||||
export interface InProgressAuthToken {
|
||||
readonly requestStatus: RequestStatus.IN_PROGRESS;
|
||||
/**
|
||||
* Unix timestamp when the current generateAuthRequest was initiated.
|
||||
* Used for figuring out how long the request status has been IN_PROGRESS.
|
||||
*/
|
||||
readonly requestTime: number;
|
||||
}
|
||||
export interface CompletedAuthToken {
|
||||
readonly requestStatus: RequestStatus.COMPLETED;
|
||||
/**
|
||||
* Firebase Installations Authentication Token.
|
||||
* Only exists if requestStatus is COMPLETED.
|
||||
*/
|
||||
readonly token: string;
|
||||
/**
|
||||
* Unix timestamp when Authentication Token was created.
|
||||
* Only exists if requestStatus is COMPLETED.
|
||||
*/
|
||||
readonly creationTime: number;
|
||||
/**
|
||||
* Authentication Token time to live duration in milliseconds.
|
||||
* Only exists if requestStatus is COMPLETED.
|
||||
*/
|
||||
readonly expiresIn: number;
|
||||
}
|
||||
export declare type AuthToken = NotStartedAuthToken | InProgressAuthToken | CompletedAuthToken;
|
||||
export interface UnregisteredInstallationEntry {
|
||||
/** Status of the Firebase Installation registration on the server. */
|
||||
readonly registrationStatus: RequestStatus.NOT_STARTED;
|
||||
/** Firebase Installation ID */
|
||||
readonly fid: string;
|
||||
}
|
||||
export interface InProgressInstallationEntry {
|
||||
/** Status of the Firebase Installation registration on the server. */
|
||||
readonly registrationStatus: RequestStatus.IN_PROGRESS;
|
||||
/**
|
||||
* Unix timestamp that shows the time when the current createInstallation
|
||||
* request was initiated.
|
||||
* Used for figuring out how long the registration status has been PENDING.
|
||||
*/
|
||||
readonly registrationTime: number;
|
||||
/** Firebase Installation ID */
|
||||
readonly fid: string;
|
||||
}
|
||||
export interface RegisteredInstallationEntry {
|
||||
/** Status of the Firebase Installation registration on the server. */
|
||||
readonly registrationStatus: RequestStatus.COMPLETED;
|
||||
/** Firebase Installation ID */
|
||||
readonly fid: string;
|
||||
/**
|
||||
* Refresh Token returned from the server.
|
||||
* Used for authenticating generateAuthToken requests.
|
||||
*/
|
||||
readonly refreshToken: string;
|
||||
/** Firebase Installation Authentication Token. */
|
||||
readonly authToken: AuthToken;
|
||||
}
|
||||
/** Firebase Installation ID and related data in the database. */
|
||||
export declare type InstallationEntry = UnregisteredInstallationEntry | InProgressInstallationEntry | RegisteredInstallationEntry;
|
||||
23
node_modules/@firebase/installations/dist/src/util/constants.d.ts
generated
vendored
Normal file
23
node_modules/@firebase/installations/dist/src/util/constants.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export declare const PENDING_TIMEOUT_MS = 10000;
|
||||
export declare const PACKAGE_VERSION: string;
|
||||
export declare const INTERNAL_AUTH_VERSION = "FIS_v2";
|
||||
export declare const INSTALLATIONS_API_URL = "https://firebaseinstallations.googleapis.com/v1";
|
||||
export declare const TOKEN_EXPIRATION_BUFFER: number;
|
||||
export declare const SERVICE = "installations";
|
||||
export declare const SERVICE_NAME = "Installations";
|
||||
42
node_modules/@firebase/installations/dist/src/util/errors.d.ts
generated
vendored
Normal file
42
node_modules/@firebase/installations/dist/src/util/errors.d.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ErrorFactory, FirebaseError } from '@firebase/util';
|
||||
export declare const enum ErrorCode {
|
||||
MISSING_APP_CONFIG_VALUES = "missing-app-config-values",
|
||||
CREATE_INSTALLATION_FAILED = "create-installation-failed",
|
||||
GENERATE_TOKEN_FAILED = "generate-token-failed",
|
||||
NOT_REGISTERED = "not-registered",
|
||||
INSTALLATION_NOT_FOUND = "installation-not-found",
|
||||
REQUEST_FAILED = "request-failed",
|
||||
APP_OFFLINE = "app-offline",
|
||||
DELETE_PENDING_REGISTRATION = "delete-pending-registration"
|
||||
}
|
||||
interface ErrorParams {
|
||||
[ErrorCode.REQUEST_FAILED]: {
|
||||
requestName: string;
|
||||
} & ServerErrorData;
|
||||
}
|
||||
export declare const ERROR_FACTORY: ErrorFactory<ErrorCode, ErrorParams>;
|
||||
export interface ServerErrorData {
|
||||
serverCode: number;
|
||||
serverMessage: string;
|
||||
serverStatus: string;
|
||||
}
|
||||
export declare type ServerError = FirebaseError & ServerErrorData;
|
||||
/** Returns true if error is a FirebaseError that is based on an error from the server. */
|
||||
export declare function isServerError(error: unknown): error is ServerError;
|
||||
export {};
|
||||
18
node_modules/@firebase/installations/dist/src/util/sleep.d.ts
generated
vendored
Normal file
18
node_modules/@firebase/installations/dist/src/util/sleep.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/** Returns a promise that resolves after given time passes. */
|
||||
export declare function sleep(ms: number): Promise<void>;
|
||||
31
node_modules/@firebase/installations/karma.conf.js
generated
vendored
Normal file
31
node_modules/@firebase/installations/karma.conf.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
const karmaBase = require('../../config/karma.base');
|
||||
|
||||
const files = ['src/**/*.test.ts'];
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
...karmaBase,
|
||||
files,
|
||||
preprocessors: { '**/*.ts': ['webpack', 'sourcemap'] },
|
||||
frameworks: ['mocha']
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.files = files;
|
||||
90
node_modules/@firebase/installations/package.json
generated
vendored
Normal file
90
node_modules/@firebase/installations/package.json
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"_from": "@firebase/installations@0.2.6",
|
||||
"_id": "@firebase/installations@0.2.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-hkuKmBtnsmqIfWxt9KyaN+cP574pfTcB81IG5tnmVcgP1xQ4hyQ9LRP0M7jDTGWMw272TInBzUuaM05xw9GMnA==",
|
||||
"_location": "/@firebase/installations",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@firebase/installations@0.2.6",
|
||||
"name": "@firebase/installations",
|
||||
"escapedName": "@firebase%2finstallations",
|
||||
"scope": "@firebase",
|
||||
"rawSpec": "0.2.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.2.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@firebase/performance",
|
||||
"/firebase"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.2.6.tgz",
|
||||
"_shasum": "a4b55e7ffc57eb4619478f9f54784626e0c22d6b",
|
||||
"_spec": "@firebase/installations@0.2.6",
|
||||
"_where": "C:\\Users\\matia\\Documents\\GitHub\\FutoX-Musix\\node_modules\\firebase",
|
||||
"author": {
|
||||
"name": "Firebase",
|
||||
"email": "firebase-support@google.com",
|
||||
"url": "https://firebase.google.com/"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@firebase/installations-types": "0.1.2",
|
||||
"@firebase/util": "0.2.27",
|
||||
"idb": "3.0.2",
|
||||
"tslib": "1.10.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"devDependencies": {
|
||||
"@types/chai": "4.2.0",
|
||||
"@types/chai-as-promised": "7.1.2",
|
||||
"@types/mocha": "5.2.7",
|
||||
"@types/sinon": "7.0.13",
|
||||
"@types/sinon-chai": "3.2.3",
|
||||
"@typescript-eslint/eslint-plugin": "2.0.0",
|
||||
"@typescript-eslint/eslint-plugin-tslint": "2.0.0",
|
||||
"@typescript-eslint/parser": "2.0.0",
|
||||
"chai": "4.2.0",
|
||||
"chai-as-promised": "7.1.1",
|
||||
"eslint": "5.16.0",
|
||||
"eslint-plugin-import": "2.18.2",
|
||||
"http-server": "0.11.1",
|
||||
"mocha": "6.2.0",
|
||||
"rollup": "1.20.3",
|
||||
"rollup-plugin-commonjs": "10.1.0",
|
||||
"rollup-plugin-json": "4.0.0",
|
||||
"rollup-plugin-node-resolve": "5.2.0",
|
||||
"rollup-plugin-typescript2": "0.24.0",
|
||||
"rollup-plugin-uglify": "6.0.3",
|
||||
"sinon": "7.4.1",
|
||||
"sinon-chai": "3.3.0",
|
||||
"tslint": "5.19.0",
|
||||
"typescript": "3.5.3"
|
||||
},
|
||||
"esm2017": "dist/index.esm2017.js",
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/index.cjs.js",
|
||||
"module": "dist/index.esm.js",
|
||||
"name": "@firebase/installations",
|
||||
"peerDependencies": {
|
||||
"@firebase/app": "0.x",
|
||||
"@firebase/app-types": "0.x"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"lint": "eslint -c .eslintrc.json '**/*.ts' --ignore-path '../../.gitignore'",
|
||||
"lint:fix": "eslint --fix -c .eslintrc.json '**/*.ts'",
|
||||
"prepare": "yarn build",
|
||||
"serve": "yarn serve:build && yarn serve:host",
|
||||
"serve:build": "rollup -c test-app/rollup.config.js",
|
||||
"serve:host": "http-server -c-1 test-app",
|
||||
"test": "yarn type-check && yarn test:karma && yarn lint",
|
||||
"test:debug": "karma start --browsers=Chrome --auto-watch",
|
||||
"test:karma": "karma start --single-run",
|
||||
"type-check": "tsc -p . --noEmit"
|
||||
},
|
||||
"types": "dist/src/index.d.ts",
|
||||
"version": "0.2.6"
|
||||
}
|
||||
70
node_modules/@firebase/installations/rollup.config.js
generated
vendored
Normal file
70
node_modules/@firebase/installations/rollup.config.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import json from 'rollup-plugin-json';
|
||||
import typescriptPlugin from 'rollup-plugin-typescript2';
|
||||
import pkg from './package.json';
|
||||
import typescript from 'typescript';
|
||||
|
||||
const deps = Object.keys({ ...pkg.peerDependencies, ...pkg.dependencies });
|
||||
|
||||
/**
|
||||
* ES5 Builds
|
||||
*/
|
||||
const es5BuildPlugins = [typescriptPlugin({ typescript }), json()];
|
||||
|
||||
const es5Builds = [
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: [
|
||||
{ file: pkg.main, format: 'cjs', sourcemap: true },
|
||||
{ file: pkg.module, format: 'es', sourcemap: true }
|
||||
],
|
||||
plugins: es5BuildPlugins,
|
||||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* ES2017 Builds
|
||||
*/
|
||||
const es2017BuildPlugins = [
|
||||
typescriptPlugin({
|
||||
typescript,
|
||||
tsconfigOverride: {
|
||||
compilerOptions: {
|
||||
target: 'es2017'
|
||||
}
|
||||
}
|
||||
}),
|
||||
json({ preferConst: true })
|
||||
];
|
||||
|
||||
const es2017Builds = [
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
file: pkg.esm2017,
|
||||
format: 'es',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: es2017BuildPlugins,
|
||||
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
|
||||
}
|
||||
];
|
||||
|
||||
export default [...es5Builds, ...es2017Builds];
|
||||
74
node_modules/@firebase/installations/src/api/common.test.ts
generated
vendored
Normal file
74
node_modules/@firebase/installations/src/api/common.test.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import '../testing/setup';
|
||||
import { retryIfServerError } from './common';
|
||||
|
||||
describe('common', () => {
|
||||
describe('retryIfServerError', () => {
|
||||
let fetchStub: SinonStub<[], Promise<Response>>;
|
||||
|
||||
beforeEach(() => {
|
||||
fetchStub = stub();
|
||||
});
|
||||
|
||||
it('retries once if the server returns a 5xx error', async () => {
|
||||
const expectedResponse = new Response();
|
||||
fetchStub.onCall(0).resolves(new Response(null, { status: 500 }));
|
||||
fetchStub.onCall(1).resolves(expectedResponse);
|
||||
|
||||
await expect(retryIfServerError(fetchStub)).to.eventually.equal(
|
||||
expectedResponse
|
||||
);
|
||||
expect(fetchStub).to.be.calledTwice;
|
||||
});
|
||||
|
||||
it('does not retry again if the server returns a 5xx error twice', async () => {
|
||||
const expectedResponse = new Response(null, { status: 500 });
|
||||
fetchStub.onCall(0).resolves(new Response(null, { status: 500 }));
|
||||
fetchStub.onCall(1).resolves(expectedResponse);
|
||||
fetchStub.onCall(2).resolves(new Response());
|
||||
|
||||
await expect(retryIfServerError(fetchStub)).to.eventually.equal(
|
||||
expectedResponse
|
||||
);
|
||||
expect(fetchStub).to.be.calledTwice;
|
||||
});
|
||||
|
||||
it('does not retry if the error is not 5xx', async () => {
|
||||
const expectedResponse = new Response(null, { status: 404 });
|
||||
fetchStub.resolves(expectedResponse);
|
||||
|
||||
await expect(retryIfServerError(fetchStub)).to.eventually.equal(
|
||||
expectedResponse
|
||||
);
|
||||
expect(fetchStub).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('does not retry if response is ok', async () => {
|
||||
const expectedResponse = new Response();
|
||||
fetchStub.resolves(expectedResponse);
|
||||
|
||||
await expect(retryIfServerError(fetchStub)).to.eventually.equal(
|
||||
expectedResponse
|
||||
);
|
||||
expect(fetchStub).to.be.calledOnce;
|
||||
});
|
||||
});
|
||||
});
|
||||
111
node_modules/@firebase/installations/src/api/common.ts
generated
vendored
Normal file
111
node_modules/@firebase/installations/src/api/common.ts
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { GenerateAuthTokenResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
CompletedAuthToken,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import {
|
||||
INSTALLATIONS_API_URL,
|
||||
INTERNAL_AUTH_VERSION
|
||||
} from '../util/constants';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
|
||||
export function getInstallationsEndpoint({ projectId }: AppConfig): string {
|
||||
return `${INSTALLATIONS_API_URL}/projects/${projectId}/installations`;
|
||||
}
|
||||
|
||||
export function extractAuthTokenInfoFromResponse(
|
||||
response: GenerateAuthTokenResponse
|
||||
): CompletedAuthToken {
|
||||
return {
|
||||
token: response.token,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
expiresIn: getExpiresInFromResponseExpiresIn(response.expiresIn),
|
||||
creationTime: Date.now()
|
||||
};
|
||||
}
|
||||
|
||||
export async function getErrorFromResponse(
|
||||
requestName: string,
|
||||
response: Response
|
||||
): Promise<FirebaseError> {
|
||||
const responseJson: ErrorResponse = await response.json();
|
||||
const errorData = responseJson.error;
|
||||
return ERROR_FACTORY.create(ErrorCode.REQUEST_FAILED, {
|
||||
requestName,
|
||||
serverCode: errorData.code,
|
||||
serverMessage: errorData.message,
|
||||
serverStatus: errorData.status
|
||||
});
|
||||
}
|
||||
|
||||
export function getHeaders({ apiKey }: AppConfig): Headers {
|
||||
return new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
'x-goog-api-key': apiKey
|
||||
});
|
||||
}
|
||||
|
||||
export function getHeadersWithAuth(
|
||||
appConfig: AppConfig,
|
||||
{ refreshToken }: RegisteredInstallationEntry
|
||||
): Headers {
|
||||
const headers = getHeaders(appConfig);
|
||||
headers.append('Authorization', getAuthorizationHeader(refreshToken));
|
||||
return headers;
|
||||
}
|
||||
|
||||
export interface ErrorResponse {
|
||||
error: {
|
||||
code: number;
|
||||
message: string;
|
||||
status: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the passed in fetch wrapper and returns the response.
|
||||
* If the returned response has a status of 5xx, re-runs the function once and
|
||||
* returns the response.
|
||||
*/
|
||||
export async function retryIfServerError(
|
||||
fn: () => Promise<Response>
|
||||
): Promise<Response> {
|
||||
const result = await fn();
|
||||
|
||||
if (result.status >= 500 && result.status < 600) {
|
||||
// Internal Server Error. Retry request.
|
||||
return fn();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function getExpiresInFromResponseExpiresIn(responseExpiresIn: string): number {
|
||||
// This works because the server will never respond with fractions of a second.
|
||||
return Number(responseExpiresIn.replace('s', '000'));
|
||||
}
|
||||
|
||||
function getAuthorizationHeader(refreshToken: string): string {
|
||||
return `${INTERNAL_AUTH_VERSION} ${refreshToken}`;
|
||||
}
|
||||
164
node_modules/@firebase/installations/src/api/create-installation.test.ts
generated
vendored
Normal file
164
node_modules/@firebase/installations/src/api/create-installation.test.ts
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { CreateInstallationResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { compareHeaders } from '../testing/compare-headers';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import {
|
||||
INSTALLATIONS_API_URL,
|
||||
INTERNAL_AUTH_VERSION,
|
||||
PACKAGE_VERSION
|
||||
} from '../util/constants';
|
||||
import { ErrorResponse } from './common';
|
||||
import { createInstallation } from './create-installation';
|
||||
|
||||
const FID = 'defenders-of-the-faith';
|
||||
|
||||
describe('createInstallation', () => {
|
||||
let appConfig: AppConfig;
|
||||
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
|
||||
let inProgressInstallationEntry: InProgressInstallationEntry;
|
||||
let response: CreateInstallationResponse;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = getFakeAppConfig();
|
||||
|
||||
inProgressInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: Date.now()
|
||||
};
|
||||
|
||||
response = {
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token:
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
|
||||
expiresIn: '604800s'
|
||||
},
|
||||
fid: FID
|
||||
};
|
||||
fetchSpy = stub(self, 'fetch');
|
||||
});
|
||||
|
||||
describe('successful request', () => {
|
||||
beforeEach(() => {
|
||||
fetchSpy.resolves(new Response(JSON.stringify(response)));
|
||||
});
|
||||
|
||||
it('registers a pending InstallationEntry', async () => {
|
||||
const registeredInstallationEntry = await createInstallation(
|
||||
appConfig,
|
||||
inProgressInstallationEntry
|
||||
);
|
||||
expect(registeredInstallationEntry.registrationStatus).to.equal(
|
||||
RequestStatus.COMPLETED
|
||||
);
|
||||
});
|
||||
|
||||
it('calls the createInstallation server API with correct parameters', async () => {
|
||||
const expectedHeaders = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
'x-goog-api-key': 'apiKey'
|
||||
});
|
||||
const expectedBody = {
|
||||
fid: FID,
|
||||
authVersion: INTERNAL_AUTH_VERSION,
|
||||
appId: appConfig.appId,
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
};
|
||||
const expectedRequest: RequestInit = {
|
||||
method: 'POST',
|
||||
headers: expectedHeaders,
|
||||
body: JSON.stringify(expectedBody)
|
||||
};
|
||||
const expectedEndpoint = `${INSTALLATIONS_API_URL}/projects/projectId/installations`;
|
||||
|
||||
await createInstallation(appConfig, inProgressInstallationEntry);
|
||||
expect(fetchSpy).to.be.calledOnceWith(expectedEndpoint, expectedRequest);
|
||||
const actualHeaders = fetchSpy.lastCall.lastArg.headers;
|
||||
compareHeaders(expectedHeaders, actualHeaders);
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the FID from the request if the response does not contain one', async () => {
|
||||
response = {
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token:
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
|
||||
expiresIn: '604800s'
|
||||
}
|
||||
};
|
||||
fetchSpy.resolves(new Response(JSON.stringify(response)));
|
||||
|
||||
const registeredInstallationEntry = await createInstallation(
|
||||
appConfig,
|
||||
inProgressInstallationEntry
|
||||
);
|
||||
expect(registeredInstallationEntry.fid).to.equal(FID);
|
||||
});
|
||||
|
||||
describe('failed request', () => {
|
||||
it('throws a FirebaseError with the error information from the server', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 409,
|
||||
message: 'Requested entity already exists',
|
||||
status: 'ALREADY_EXISTS'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy.resolves(
|
||||
new Response(JSON.stringify(errorResponse), { status: 409 })
|
||||
);
|
||||
|
||||
await expect(
|
||||
createInstallation(appConfig, inProgressInstallationEntry)
|
||||
).to.be.rejectedWith(FirebaseError);
|
||||
});
|
||||
|
||||
it('retries once if the server returns a 5xx error', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 500,
|
||||
message: 'Internal server error',
|
||||
status: 'SERVER_ERROR'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy
|
||||
.onCall(0)
|
||||
.resolves(new Response(JSON.stringify(errorResponse), { status: 500 }));
|
||||
fetchSpy.onCall(1).resolves(new Response(JSON.stringify(response)));
|
||||
|
||||
await expect(createInstallation(appConfig, inProgressInstallationEntry))
|
||||
.to.be.fulfilled;
|
||||
expect(fetchSpy).to.be.calledTwice;
|
||||
});
|
||||
});
|
||||
});
|
||||
67
node_modules/@firebase/installations/src/api/create-installation.ts
generated
vendored
Normal file
67
node_modules/@firebase/installations/src/api/create-installation.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CreateInstallationResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { INTERNAL_AUTH_VERSION, PACKAGE_VERSION } from '../util/constants';
|
||||
import {
|
||||
extractAuthTokenInfoFromResponse,
|
||||
getErrorFromResponse,
|
||||
getHeaders,
|
||||
getInstallationsEndpoint,
|
||||
retryIfServerError
|
||||
} from './common';
|
||||
|
||||
export async function createInstallation(
|
||||
appConfig: AppConfig,
|
||||
{ fid }: InProgressInstallationEntry
|
||||
): Promise<RegisteredInstallationEntry> {
|
||||
const endpoint = getInstallationsEndpoint(appConfig);
|
||||
|
||||
const headers = getHeaders(appConfig);
|
||||
const body = {
|
||||
fid,
|
||||
authVersion: INTERNAL_AUTH_VERSION,
|
||||
appId: appConfig.appId,
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
};
|
||||
|
||||
const request: RequestInit = {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(body)
|
||||
};
|
||||
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (response.ok) {
|
||||
const responseValue: CreateInstallationResponse = await response.json();
|
||||
const registeredInstallationEntry: RegisteredInstallationEntry = {
|
||||
fid: responseValue.fid || fid,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: responseValue.refreshToken,
|
||||
authToken: extractAuthTokenInfoFromResponse(responseValue.authToken)
|
||||
};
|
||||
return registeredInstallationEntry;
|
||||
} else {
|
||||
throw await getErrorFromResponse('Create Installation', response);
|
||||
}
|
||||
}
|
||||
122
node_modules/@firebase/installations/src/api/delete-installation.test.ts
generated
vendored
Normal file
122
node_modules/@firebase/installations/src/api/delete-installation.test.ts
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { compareHeaders } from '../testing/compare-headers';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import {
|
||||
INSTALLATIONS_API_URL,
|
||||
INTERNAL_AUTH_VERSION
|
||||
} from '../util/constants';
|
||||
import { ErrorResponse } from './common';
|
||||
import { deleteInstallation } from './delete-installation';
|
||||
|
||||
const FID = 'foreclosure-of-a-dream';
|
||||
|
||||
describe('deleteInstallation', () => {
|
||||
let appConfig: AppConfig;
|
||||
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
|
||||
let registeredInstallationEntry: RegisteredInstallationEntry;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = getFakeAppConfig();
|
||||
|
||||
registeredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy = stub(self, 'fetch');
|
||||
});
|
||||
|
||||
describe('successful request', () => {
|
||||
beforeEach(() => {
|
||||
fetchSpy.resolves(new Response());
|
||||
});
|
||||
|
||||
it('calls the deleteInstallation server API with correct parameters', async () => {
|
||||
const expectedHeaders = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
Authorization: `${INTERNAL_AUTH_VERSION} refreshToken`,
|
||||
'x-goog-api-key': 'apiKey'
|
||||
});
|
||||
const expectedRequest: RequestInit = {
|
||||
method: 'DELETE',
|
||||
headers: expectedHeaders
|
||||
};
|
||||
const expectedEndpoint = `${INSTALLATIONS_API_URL}/projects/projectId/installations/${FID}`;
|
||||
|
||||
await deleteInstallation(appConfig, registeredInstallationEntry);
|
||||
|
||||
expect(fetchSpy).to.be.calledOnceWith(expectedEndpoint, expectedRequest);
|
||||
const actualHeaders = fetchSpy.lastCall.lastArg.headers;
|
||||
compareHeaders(expectedHeaders, actualHeaders);
|
||||
});
|
||||
});
|
||||
|
||||
describe('failed request', () => {
|
||||
it('throws a FirebaseError with the error information from the server', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 409,
|
||||
message: 'Requested entity already exists',
|
||||
status: 'ALREADY_EXISTS'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy.resolves(
|
||||
new Response(JSON.stringify(errorResponse), { status: 409 })
|
||||
);
|
||||
|
||||
await expect(
|
||||
deleteInstallation(appConfig, registeredInstallationEntry)
|
||||
).to.be.rejectedWith(FirebaseError);
|
||||
});
|
||||
|
||||
it('retries once if the server returns a 5xx error', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 500,
|
||||
message: 'Internal server error',
|
||||
status: 'SERVER_ERROR'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy
|
||||
.onCall(0)
|
||||
.resolves(new Response(JSON.stringify(errorResponse), { status: 500 }));
|
||||
fetchSpy.onCall(1).resolves(new Response());
|
||||
|
||||
await expect(deleteInstallation(appConfig, registeredInstallationEntry))
|
||||
.to.be.fulfilled;
|
||||
expect(fetchSpy).to.be.calledTwice;
|
||||
});
|
||||
});
|
||||
});
|
||||
50
node_modules/@firebase/installations/src/api/delete-installation.ts
generated
vendored
Normal file
50
node_modules/@firebase/installations/src/api/delete-installation.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { RegisteredInstallationEntry } from '../interfaces/installation-entry';
|
||||
import {
|
||||
getErrorFromResponse,
|
||||
getHeadersWithAuth,
|
||||
getInstallationsEndpoint,
|
||||
retryIfServerError
|
||||
} from './common';
|
||||
|
||||
export async function deleteInstallation(
|
||||
appConfig: AppConfig,
|
||||
installationEntry: RegisteredInstallationEntry
|
||||
): Promise<void> {
|
||||
const endpoint = getDeleteEndpoint(appConfig, installationEntry);
|
||||
|
||||
const headers = getHeadersWithAuth(appConfig, installationEntry);
|
||||
const request: RequestInit = {
|
||||
method: 'DELETE',
|
||||
headers
|
||||
};
|
||||
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (!response.ok) {
|
||||
throw await getErrorFromResponse('Delete Installation', response);
|
||||
}
|
||||
}
|
||||
|
||||
function getDeleteEndpoint(
|
||||
appConfig: AppConfig,
|
||||
{ fid }: RegisteredInstallationEntry
|
||||
): string {
|
||||
return `${getInstallationsEndpoint(appConfig)}/${fid}`;
|
||||
}
|
||||
148
node_modules/@firebase/installations/src/api/generate-auth-token.test.ts
generated
vendored
Normal file
148
node_modules/@firebase/installations/src/api/generate-auth-token.test.ts
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import { GenerateAuthTokenResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
CompletedAuthToken,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { compareHeaders } from '../testing/compare-headers';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import {
|
||||
INSTALLATIONS_API_URL,
|
||||
INTERNAL_AUTH_VERSION,
|
||||
PACKAGE_VERSION
|
||||
} from '../util/constants';
|
||||
import { ErrorResponse } from './common';
|
||||
import { generateAuthToken } from './generate-auth-token';
|
||||
|
||||
const FID = 'evil-has-no-boundaries';
|
||||
|
||||
describe('generateAuthToken', () => {
|
||||
let appConfig: AppConfig;
|
||||
let fetchSpy: SinonStub<[RequestInfo, RequestInit?], Promise<Response>>;
|
||||
let registeredInstallationEntry: RegisteredInstallationEntry;
|
||||
let response: GenerateAuthTokenResponse;
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = getFakeAppConfig();
|
||||
|
||||
registeredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
};
|
||||
|
||||
response = {
|
||||
token:
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
|
||||
expiresIn: '604800s'
|
||||
};
|
||||
|
||||
fetchSpy = stub(self, 'fetch');
|
||||
});
|
||||
|
||||
describe('successful request', () => {
|
||||
beforeEach(() => {
|
||||
fetchSpy.resolves(new Response(JSON.stringify(response)));
|
||||
});
|
||||
|
||||
it('fetches a new Authentication Token', async () => {
|
||||
const completedAuthToken: CompletedAuthToken = await generateAuthToken(
|
||||
appConfig,
|
||||
registeredInstallationEntry
|
||||
);
|
||||
expect(completedAuthToken.requestStatus).to.equal(
|
||||
RequestStatus.COMPLETED
|
||||
);
|
||||
});
|
||||
|
||||
it('calls the generateAuthToken server API with correct parameters', async () => {
|
||||
const expectedHeaders = new Headers({
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
Authorization: `${INTERNAL_AUTH_VERSION} refreshToken`,
|
||||
'x-goog-api-key': 'apiKey'
|
||||
});
|
||||
const expectedBody = {
|
||||
installation: {
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
}
|
||||
};
|
||||
const expectedRequest: RequestInit = {
|
||||
method: 'POST',
|
||||
headers: expectedHeaders,
|
||||
body: JSON.stringify(expectedBody)
|
||||
};
|
||||
const expectedEndpoint = `${INSTALLATIONS_API_URL}/projects/projectId/installations/${FID}/authTokens:generate`;
|
||||
|
||||
await generateAuthToken(appConfig, registeredInstallationEntry);
|
||||
|
||||
expect(fetchSpy).to.be.calledOnceWith(expectedEndpoint, expectedRequest);
|
||||
const actualHeaders = fetchSpy.lastCall.lastArg.headers;
|
||||
compareHeaders(expectedHeaders, actualHeaders);
|
||||
});
|
||||
});
|
||||
|
||||
describe('failed request', () => {
|
||||
it('throws a FirebaseError with the error information from the server', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 409,
|
||||
message: 'Requested entity already exists',
|
||||
status: 'ALREADY_EXISTS'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy.resolves(
|
||||
new Response(JSON.stringify(errorResponse), { status: 409 })
|
||||
);
|
||||
|
||||
await expect(
|
||||
generateAuthToken(appConfig, registeredInstallationEntry)
|
||||
).to.be.rejectedWith(FirebaseError);
|
||||
});
|
||||
|
||||
it('retries once if the server returns a 5xx error', async () => {
|
||||
const errorResponse: ErrorResponse = {
|
||||
error: {
|
||||
code: 500,
|
||||
message: 'Internal server error',
|
||||
status: 'SERVER_ERROR'
|
||||
}
|
||||
};
|
||||
|
||||
fetchSpy
|
||||
.onCall(0)
|
||||
.resolves(new Response(JSON.stringify(errorResponse), { status: 500 }));
|
||||
fetchSpy.onCall(1).resolves(new Response(JSON.stringify(response)));
|
||||
|
||||
await expect(generateAuthToken(appConfig, registeredInstallationEntry)).to
|
||||
.be.fulfilled;
|
||||
expect(fetchSpy).to.be.calledTwice;
|
||||
});
|
||||
});
|
||||
});
|
||||
69
node_modules/@firebase/installations/src/api/generate-auth-token.ts
generated
vendored
Normal file
69
node_modules/@firebase/installations/src/api/generate-auth-token.ts
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { GenerateAuthTokenResponse } from '../interfaces/api-response';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
CompletedAuthToken,
|
||||
RegisteredInstallationEntry
|
||||
} from '../interfaces/installation-entry';
|
||||
import { PACKAGE_VERSION } from '../util/constants';
|
||||
import {
|
||||
extractAuthTokenInfoFromResponse,
|
||||
getErrorFromResponse,
|
||||
getHeadersWithAuth,
|
||||
getInstallationsEndpoint,
|
||||
retryIfServerError
|
||||
} from './common';
|
||||
|
||||
export async function generateAuthToken(
|
||||
appConfig: AppConfig,
|
||||
installationEntry: RegisteredInstallationEntry
|
||||
): Promise<CompletedAuthToken> {
|
||||
const endpoint = getGenerateAuthTokenEndpoint(appConfig, installationEntry);
|
||||
|
||||
const headers = getHeadersWithAuth(appConfig, installationEntry);
|
||||
const body = {
|
||||
installation: {
|
||||
sdkVersion: PACKAGE_VERSION
|
||||
}
|
||||
};
|
||||
|
||||
const request: RequestInit = {
|
||||
method: 'POST',
|
||||
headers,
|
||||
body: JSON.stringify(body)
|
||||
};
|
||||
|
||||
const response = await retryIfServerError(() => fetch(endpoint, request));
|
||||
if (response.ok) {
|
||||
const responseValue: GenerateAuthTokenResponse = await response.json();
|
||||
const completedAuthToken: CompletedAuthToken = extractAuthTokenInfoFromResponse(
|
||||
responseValue
|
||||
);
|
||||
return completedAuthToken;
|
||||
} else {
|
||||
throw await getErrorFromResponse('Generate Auth Token', response);
|
||||
}
|
||||
}
|
||||
|
||||
function getGenerateAuthTokenEndpoint(
|
||||
appConfig: AppConfig,
|
||||
{ fid }: RegisteredInstallationEntry
|
||||
): string {
|
||||
return `${getInstallationsEndpoint(appConfig)}/${fid}/authTokens:generate`;
|
||||
}
|
||||
129
node_modules/@firebase/installations/src/functions/delete-installation.test.ts
generated
vendored
Normal file
129
node_modules/@firebase/installations/src/functions/delete-installation.test.ts
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import * as deleteInstallationModule from '../api/delete-installation';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { get, set } from '../helpers/idb-manager';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus,
|
||||
UnregisteredInstallationEntry
|
||||
} from '../interfaces/installation-entry';
|
||||
import { getFakeApp } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { ErrorCode } from '../util/errors';
|
||||
import { sleep } from '../util/sleep';
|
||||
import { deleteInstallation } from './delete-installation';
|
||||
|
||||
const FID = 'children-of-the-damned';
|
||||
|
||||
describe('deleteInstallation', () => {
|
||||
let app: FirebaseApp;
|
||||
let appConfig: AppConfig;
|
||||
let deleteInstallationSpy: SinonStub<
|
||||
[AppConfig, RegisteredInstallationEntry],
|
||||
Promise<void>
|
||||
>;
|
||||
|
||||
beforeEach(() => {
|
||||
app = getFakeApp();
|
||||
appConfig = extractAppConfig(app);
|
||||
|
||||
deleteInstallationSpy = stub(
|
||||
deleteInstallationModule,
|
||||
'deleteInstallation'
|
||||
).callsFake(
|
||||
() => sleep(100) // Request would take some time
|
||||
);
|
||||
});
|
||||
|
||||
it('resolves without calling server API if there is no installation', async () => {
|
||||
await expect(deleteInstallation(app)).to.be.fulfilled;
|
||||
expect(deleteInstallationSpy).not.to.have.been.called;
|
||||
});
|
||||
|
||||
it('deletes and resolves without calling server API if the installation is unregistered', async () => {
|
||||
const entry: UnregisteredInstallationEntry = {
|
||||
registrationStatus: RequestStatus.NOT_STARTED,
|
||||
fid: FID
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
|
||||
await expect(deleteInstallation(app)).to.be.fulfilled;
|
||||
expect(deleteInstallationSpy).not.to.have.been.called;
|
||||
await expect(get(appConfig)).to.eventually.be.undefined;
|
||||
});
|
||||
|
||||
it('rejects without calling server API if the installation is pending', async () => {
|
||||
const entry: InProgressInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: Date.now() - 3 * 1000
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
|
||||
await expect(deleteInstallation(app)).to.be.rejectedWith(
|
||||
ErrorCode.DELETE_PENDING_REGISTRATION
|
||||
);
|
||||
expect(deleteInstallationSpy).not.to.have.been.called;
|
||||
});
|
||||
|
||||
it('rejects without calling server API if the installation is registered and app is offline', async () => {
|
||||
const entry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: 'authToken',
|
||||
expiresIn: 123456,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
await expect(deleteInstallation(app)).to.be.rejectedWith(
|
||||
ErrorCode.APP_OFFLINE
|
||||
);
|
||||
expect(deleteInstallationSpy).not.to.have.been.called;
|
||||
});
|
||||
|
||||
it('deletes and resolves after calling server API if the installation is registered', async () => {
|
||||
const entry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: 'authToken',
|
||||
expiresIn: 123456,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
|
||||
await expect(deleteInstallation(app)).to.be.fulfilled;
|
||||
expect(deleteInstallationSpy).to.have.been.calledOnceWith(appConfig, entry);
|
||||
await expect(get(appConfig)).to.eventually.be.undefined;
|
||||
});
|
||||
});
|
||||
57
node_modules/@firebase/installations/src/functions/delete-installation.ts
generated
vendored
Normal file
57
node_modules/@firebase/installations/src/functions/delete-installation.ts
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { deleteInstallation as deleteInstallationRequest } from '../api/delete-installation';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { remove, update } from '../helpers/idb-manager';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
InstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus
|
||||
} from '../interfaces/installation-entry';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
|
||||
export async function deleteInstallation(app: FirebaseApp): Promise<void> {
|
||||
const appConfig = extractAppConfig(app);
|
||||
|
||||
const entry = await update(appConfig, (oldEntry?: InstallationEntry):
|
||||
| InProgressInstallationEntry
|
||||
| RegisteredInstallationEntry
|
||||
| undefined => {
|
||||
if (oldEntry && oldEntry.registrationStatus === RequestStatus.NOT_STARTED) {
|
||||
// Delete the unregistered entry without sending a deleteInstallation request.
|
||||
return undefined;
|
||||
}
|
||||
return oldEntry;
|
||||
});
|
||||
|
||||
if (entry) {
|
||||
if (entry.registrationStatus === RequestStatus.IN_PROGRESS) {
|
||||
// Can't delete while trying to register.
|
||||
throw ERROR_FACTORY.create(ErrorCode.DELETE_PENDING_REGISTRATION);
|
||||
} else if (entry.registrationStatus === RequestStatus.COMPLETED) {
|
||||
if (!navigator.onLine) {
|
||||
throw ERROR_FACTORY.create(ErrorCode.APP_OFFLINE);
|
||||
} else {
|
||||
await deleteInstallationRequest(appConfig, entry);
|
||||
await remove(appConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
78
node_modules/@firebase/installations/src/functions/get-id.test.ts
generated
vendored
Normal file
78
node_modules/@firebase/installations/src/functions/get-id.test.ts
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { SinonStub, stub } from 'sinon';
|
||||
import * as getInstallationEntryModule from '../helpers/get-installation-entry';
|
||||
import * as refreshAuthTokenModule from '../helpers/refresh-auth-token';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { RequestStatus } from '../interfaces/installation-entry';
|
||||
import { getFakeApp } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { getId } from './get-id';
|
||||
|
||||
const FID = 'disciples-of-the-watch';
|
||||
|
||||
describe('getId', () => {
|
||||
let getInstallationEntrySpy: SinonStub<
|
||||
[AppConfig],
|
||||
Promise<getInstallationEntryModule.InstallationEntryWithRegistrationPromise>
|
||||
>;
|
||||
|
||||
beforeEach(() => {
|
||||
getInstallationEntrySpy = stub(
|
||||
getInstallationEntryModule,
|
||||
'getInstallationEntry'
|
||||
);
|
||||
});
|
||||
|
||||
it('returns the FID in InstallationEntry returned by getInstallationEntry', async () => {
|
||||
getInstallationEntrySpy.resolves({
|
||||
installationEntry: {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
});
|
||||
|
||||
const firebaseApp = getFakeApp();
|
||||
const fid = await getId(firebaseApp);
|
||||
expect(fid).to.equal(FID);
|
||||
expect(getInstallationEntrySpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('calls refreshAuthToken if the installation is registered', async () => {
|
||||
getInstallationEntrySpy.resolves({
|
||||
installationEntry: {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const refreshAuthTokenSpy = stub(
|
||||
refreshAuthTokenModule,
|
||||
'refreshAuthToken'
|
||||
).resolves('authToken');
|
||||
|
||||
const firebaseApp = getFakeApp();
|
||||
await getId(firebaseApp);
|
||||
expect(refreshAuthTokenSpy).to.be.calledOnce;
|
||||
});
|
||||
});
|
||||
42
node_modules/@firebase/installations/src/functions/get-id.ts
generated
vendored
Normal file
42
node_modules/@firebase/installations/src/functions/get-id.ts
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { getInstallationEntry } from '../helpers/get-installation-entry';
|
||||
import { refreshAuthToken } from '../helpers/refresh-auth-token';
|
||||
import { RequestStatus } from '../interfaces/installation-entry';
|
||||
|
||||
export async function getId(app: FirebaseApp): Promise<string> {
|
||||
const appConfig = extractAppConfig(app);
|
||||
const { installationEntry, registrationPromise } = await getInstallationEntry(
|
||||
appConfig
|
||||
);
|
||||
|
||||
if (registrationPromise) {
|
||||
// Suppress registration errors as they are not a problem for getId.
|
||||
registrationPromise.catch(() => {});
|
||||
}
|
||||
|
||||
if (installationEntry.registrationStatus === RequestStatus.COMPLETED) {
|
||||
// If the installation is already registered, update the authentication
|
||||
// token if needed. Suppress errors as they are not relevant to getId.
|
||||
refreshAuthToken(appConfig).catch(() => {});
|
||||
}
|
||||
|
||||
return installationEntry.fid;
|
||||
}
|
||||
450
node_modules/@firebase/installations/src/functions/get-token.test.ts
generated
vendored
Normal file
450
node_modules/@firebase/installations/src/functions/get-token.test.ts
generated
vendored
Normal file
@@ -0,0 +1,450 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { expect } from 'chai';
|
||||
import { SinonFakeTimers, SinonStub, stub, useFakeTimers } from 'sinon';
|
||||
import * as createInstallationModule from '../api/create-installation';
|
||||
import * as generateAuthTokenModule from '../api/generate-auth-token';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { get, set } from '../helpers/idb-manager';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
CompletedAuthToken,
|
||||
InProgressInstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus,
|
||||
UnregisteredInstallationEntry
|
||||
} from '../interfaces/installation-entry';
|
||||
import { getFakeApp } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { TOKEN_EXPIRATION_BUFFER } from '../util/constants';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
import { sleep } from '../util/sleep';
|
||||
import { getToken } from './get-token';
|
||||
|
||||
const FID = 'dont-talk-to-strangers';
|
||||
const AUTH_TOKEN = 'authTokenFromServer';
|
||||
const ONE_WEEK_MS = 7 * 24 * 60 * 60 * 1000;
|
||||
|
||||
/**
|
||||
* A map of different states of the database and a function that creates the
|
||||
* said state.
|
||||
*/
|
||||
const setupInstallationEntryMap: Map<
|
||||
string,
|
||||
(appConfig: AppConfig) => Promise<void>
|
||||
> = new Map([
|
||||
[
|
||||
'existing and valid auth token',
|
||||
async (appConfig: AppConfig) => {
|
||||
const entry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
}
|
||||
],
|
||||
[
|
||||
'expired auth token',
|
||||
async (appConfig: AppConfig) => {
|
||||
const entry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now() - 2 * ONE_WEEK_MS
|
||||
}
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
}
|
||||
],
|
||||
[
|
||||
'pending auth token',
|
||||
async (appConfig: AppConfig) => {
|
||||
const entry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.IN_PROGRESS,
|
||||
requestTime: Date.now() - 3 * 1000
|
||||
}
|
||||
};
|
||||
|
||||
await set(appConfig, entry);
|
||||
|
||||
// Finish pending request after 500 ms
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
sleep(500).then(async () => {
|
||||
const updatedEntry: RegisteredInstallationEntry = {
|
||||
...entry,
|
||||
authToken: {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, updatedEntry);
|
||||
});
|
||||
}
|
||||
],
|
||||
[
|
||||
'no auth token',
|
||||
async (appConfig: AppConfig) => {
|
||||
const entry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
};
|
||||
await set(appConfig, entry);
|
||||
}
|
||||
],
|
||||
[
|
||||
'pending fid registration',
|
||||
async (appConfig: AppConfig) => {
|
||||
const entry: InProgressInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: Date.now() - 3 * 1000
|
||||
};
|
||||
|
||||
await set(appConfig, entry);
|
||||
|
||||
// Finish pending request after 500 ms
|
||||
// tslint:disable-next-line:no-floating-promises
|
||||
sleep(500).then(async () => {
|
||||
const updatedEntry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, updatedEntry);
|
||||
});
|
||||
}
|
||||
],
|
||||
[
|
||||
'unregistered fid',
|
||||
async (appConfig: AppConfig) => {
|
||||
const entry: UnregisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
};
|
||||
|
||||
await set(appConfig, entry);
|
||||
}
|
||||
]
|
||||
]);
|
||||
|
||||
describe('getToken', () => {
|
||||
let app: FirebaseApp;
|
||||
let appConfig: AppConfig;
|
||||
let createInstallationSpy: SinonStub<
|
||||
[AppConfig, InProgressInstallationEntry],
|
||||
Promise<RegisteredInstallationEntry>
|
||||
>;
|
||||
let generateAuthTokenSpy: SinonStub<
|
||||
[AppConfig, RegisteredInstallationEntry],
|
||||
Promise<CompletedAuthToken>
|
||||
>;
|
||||
|
||||
beforeEach(() => {
|
||||
app = getFakeApp();
|
||||
appConfig = extractAppConfig(app);
|
||||
|
||||
createInstallationSpy = stub(
|
||||
createInstallationModule,
|
||||
'createInstallation'
|
||||
).callsFake(async (_, installationEntry) => {
|
||||
await sleep(100); // Request would take some time
|
||||
const result: RegisteredInstallationEntry = {
|
||||
fid: installationEntry.fid,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
return result;
|
||||
});
|
||||
generateAuthTokenSpy = stub(
|
||||
generateAuthTokenModule,
|
||||
'generateAuthToken'
|
||||
).callsFake(async () => {
|
||||
await sleep(100); // Request would take some time
|
||||
const result: CompletedAuthToken = {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
};
|
||||
return result;
|
||||
});
|
||||
});
|
||||
|
||||
describe('basic functionality', () => {
|
||||
for (const [title, setup] of setupInstallationEntryMap.entries()) {
|
||||
describe(`when ${title} in the DB`, () => {
|
||||
beforeEach(() => setup(appConfig));
|
||||
|
||||
it('resolves with an auth token', async () => {
|
||||
const token = await getToken(app);
|
||||
expect(token).to.equal(AUTH_TOKEN);
|
||||
});
|
||||
|
||||
it('saves the token in the DB', async () => {
|
||||
const token = await getToken(app);
|
||||
const installationEntry = (await get(
|
||||
appConfig
|
||||
)) as RegisteredInstallationEntry;
|
||||
expect(installationEntry).not.to.be.undefined;
|
||||
expect(installationEntry.registrationStatus).to.equal(
|
||||
RequestStatus.COMPLETED
|
||||
);
|
||||
expect(installationEntry.authToken.requestStatus).to.equal(
|
||||
RequestStatus.COMPLETED
|
||||
);
|
||||
expect(
|
||||
(installationEntry.authToken as CompletedAuthToken).token
|
||||
).to.equal(token);
|
||||
});
|
||||
|
||||
it('returns the same token on subsequent calls', async () => {
|
||||
const token1 = await getToken(app);
|
||||
const token2 = await getToken(app);
|
||||
expect(token1).to.equal(token2);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('when there is no FID in the DB', () => {
|
||||
it('gets the token by registering a new FID', async () => {
|
||||
await getToken(app);
|
||||
expect(createInstallationSpy).to.be.called;
|
||||
expect(generateAuthTokenSpy).not.to.be.called;
|
||||
});
|
||||
|
||||
it('does not register a new FID on subsequent calls', async () => {
|
||||
await getToken(app);
|
||||
await getToken(app);
|
||||
expect(createInstallationSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('throws if the app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
await expect(getToken(app)).to.be.rejected;
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is a FID in the DB, but no auth token', () => {
|
||||
let installationEntry: RegisteredInstallationEntry;
|
||||
|
||||
beforeEach(async () => {
|
||||
installationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.NOT_STARTED
|
||||
}
|
||||
};
|
||||
await set(appConfig, installationEntry);
|
||||
});
|
||||
|
||||
it('gets the token by calling generateAuthToken', async () => {
|
||||
await getToken(app);
|
||||
expect(generateAuthTokenSpy).to.be.called;
|
||||
expect(createInstallationSpy).not.to.be.called;
|
||||
});
|
||||
|
||||
it('does not call generateAuthToken twice on subsequent calls', async () => {
|
||||
await getToken(app);
|
||||
await getToken(app);
|
||||
expect(generateAuthTokenSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('does not call generateAuthToken twice on simultaneous calls', async () => {
|
||||
await Promise.all([getToken(app), getToken(app)]);
|
||||
expect(generateAuthTokenSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('throws if the app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
await expect(getToken(app)).to.be.rejected;
|
||||
});
|
||||
|
||||
describe('and the server returns an error', () => {
|
||||
it('removes the FID from the DB if the server returns a 401 response', async () => {
|
||||
generateAuthTokenSpy.callsFake(async () => {
|
||||
throw ERROR_FACTORY.create(ErrorCode.REQUEST_FAILED, {
|
||||
requestName: 'Generate Auth Token',
|
||||
serverCode: 401,
|
||||
serverStatus: 'UNAUTHENTICATED',
|
||||
serverMessage: 'Invalid Authentication.'
|
||||
});
|
||||
});
|
||||
|
||||
await expect(getToken(app)).to.be.rejected;
|
||||
await expect(get(appConfig)).to.eventually.be.undefined;
|
||||
});
|
||||
|
||||
it('removes the FID from the DB if the server returns a 404 response', async () => {
|
||||
generateAuthTokenSpy.callsFake(async () => {
|
||||
throw ERROR_FACTORY.create(ErrorCode.REQUEST_FAILED, {
|
||||
requestName: 'Generate Auth Token',
|
||||
serverCode: 404,
|
||||
serverStatus: 'NOT_FOUND',
|
||||
serverMessage: 'FID not found.'
|
||||
});
|
||||
});
|
||||
|
||||
await expect(getToken(app)).to.be.rejected;
|
||||
await expect(get(appConfig)).to.eventually.be.undefined;
|
||||
});
|
||||
|
||||
it('does not remove the FID from the DB if the server returns any other response', async () => {
|
||||
generateAuthTokenSpy.callsFake(async () => {
|
||||
throw ERROR_FACTORY.create(ErrorCode.REQUEST_FAILED, {
|
||||
requestName: 'Generate Auth Token',
|
||||
serverCode: 500,
|
||||
serverStatus: 'INTERNAL',
|
||||
serverMessage: 'Internal server error.'
|
||||
});
|
||||
});
|
||||
|
||||
await expect(getToken(app)).to.be.rejected;
|
||||
await expect(get(appConfig)).to.eventually.deep.equal(
|
||||
installationEntry
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is a registered auth token in the DB', () => {
|
||||
beforeEach(async () => {
|
||||
const installationEntry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now()
|
||||
}
|
||||
};
|
||||
await set(appConfig, installationEntry);
|
||||
});
|
||||
|
||||
it('does not call any server APIs', async () => {
|
||||
await getToken(app);
|
||||
expect(createInstallationSpy).not.to.be.called;
|
||||
expect(generateAuthTokenSpy).not.to.be.called;
|
||||
});
|
||||
|
||||
it('works even if the app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
const token = await getToken(app);
|
||||
expect(token).to.equal(AUTH_TOKEN);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is an auth token that is about to expire in the DB', () => {
|
||||
const DB_AUTH_TOKEN = 'authTokenFromDB';
|
||||
let clock: SinonFakeTimers;
|
||||
|
||||
beforeEach(async () => {
|
||||
clock = useFakeTimers({ shouldAdvanceTime: true });
|
||||
const installationEntry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: DB_AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime:
|
||||
// Expires in ten minutes
|
||||
Date.now() - ONE_WEEK_MS + TOKEN_EXPIRATION_BUFFER + 10 * 60 * 1000
|
||||
}
|
||||
};
|
||||
await set(appConfig, installationEntry);
|
||||
});
|
||||
|
||||
it('returns a different token after expiration', async () => {
|
||||
const token1 = await getToken(app);
|
||||
expect(token1).to.equal(DB_AUTH_TOKEN);
|
||||
|
||||
// Wait 30 minutes.
|
||||
clock.tick('30:00');
|
||||
|
||||
const token2 = await getToken(app);
|
||||
await expect(token2).to.equal(AUTH_TOKEN);
|
||||
await expect(token2).not.to.equal(token1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is an expired auth token in the DB', () => {
|
||||
beforeEach(async () => {
|
||||
const installationEntry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
token: AUTH_TOKEN,
|
||||
expiresIn: ONE_WEEK_MS,
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now() - 2 * ONE_WEEK_MS
|
||||
}
|
||||
};
|
||||
await set(appConfig, installationEntry);
|
||||
});
|
||||
|
||||
it('throws if the app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
await expect(getToken(app)).to.be.rejected;
|
||||
});
|
||||
});
|
||||
});
|
||||
50
node_modules/@firebase/installations/src/functions/get-token.ts
generated
vendored
Normal file
50
node_modules/@firebase/installations/src/functions/get-token.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { extractAppConfig } from '../helpers/extract-app-config';
|
||||
import { getInstallationEntry } from '../helpers/get-installation-entry';
|
||||
import { refreshAuthToken } from '../helpers/refresh-auth-token';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { RequestStatus } from '../interfaces/installation-entry';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
|
||||
export async function getToken(app: FirebaseApp): Promise<string> {
|
||||
const appConfig = extractAppConfig(app);
|
||||
|
||||
await completeInstallationRegistration(appConfig);
|
||||
|
||||
// At this point we either have a Registered Installation in the DB, or we've
|
||||
// already thrown an error.
|
||||
return refreshAuthToken(appConfig);
|
||||
}
|
||||
|
||||
async function completeInstallationRegistration(
|
||||
appConfig: AppConfig
|
||||
): Promise<void> {
|
||||
const { installationEntry, registrationPromise } = await getInstallationEntry(
|
||||
appConfig
|
||||
);
|
||||
|
||||
if (registrationPromise) {
|
||||
// A createInstallation request is in progress. Wait until it finishes.
|
||||
await registrationPromise;
|
||||
} else if (installationEntry.registrationStatus !== RequestStatus.COMPLETED) {
|
||||
// Installation ID can't be registered.
|
||||
throw ERROR_FACTORY.create(ErrorCode.CREATE_INSTALLATION_FAILED);
|
||||
}
|
||||
}
|
||||
20
node_modules/@firebase/installations/src/functions/index.ts
generated
vendored
Normal file
20
node_modules/@firebase/installations/src/functions/index.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { getId } from './get-id';
|
||||
export { getToken } from './get-token';
|
||||
export { deleteInstallation } from './delete-installation';
|
||||
31
node_modules/@firebase/installations/src/helpers/buffer-to-base64-url-safe.test.ts
generated
vendored
Normal file
31
node_modules/@firebase/installations/src/helpers/buffer-to-base64-url-safe.test.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import '../testing/setup';
|
||||
import { bufferToBase64UrlSafe } from './buffer-to-base64-url-safe';
|
||||
|
||||
const TYPED_ARRAY_REPRESENTATION = new TextEncoder().encode('hello world');
|
||||
const BASE_64_REPRESENTATION = btoa('hello world');
|
||||
|
||||
describe('bufferToBase64', () => {
|
||||
it('returns a base64 representation of a Uint8Array', () => {
|
||||
expect(bufferToBase64UrlSafe(TYPED_ARRAY_REPRESENTATION)).to.equal(
|
||||
BASE_64_REPRESENTATION
|
||||
);
|
||||
});
|
||||
});
|
||||
21
node_modules/@firebase/installations/src/helpers/buffer-to-base64-url-safe.ts
generated
vendored
Normal file
21
node_modules/@firebase/installations/src/helpers/buffer-to-base64-url-safe.ts
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export function bufferToBase64UrlSafe(array: Uint8Array): string {
|
||||
const b64 = btoa(String.fromCharCode(...array));
|
||||
return b64.replace(/\+/g, '-').replace(/\//g, '_');
|
||||
}
|
||||
60
node_modules/@firebase/installations/src/helpers/extract-app-config.test.ts
generated
vendored
Normal file
60
node_modules/@firebase/installations/src/helpers/extract-app-config.test.ts
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseError } from '@firebase/util';
|
||||
import { expect } from 'chai';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { getFakeApp } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { extractAppConfig } from './extract-app-config';
|
||||
|
||||
describe('extractAppConfig', () => {
|
||||
it('returns AppConfig if the argument is a FirebaseApp object that includes an appId', () => {
|
||||
const firebaseApp = getFakeApp();
|
||||
const expected: AppConfig = {
|
||||
appName: 'appName',
|
||||
apiKey: 'apiKey',
|
||||
projectId: 'projectId',
|
||||
appId: '1:777777777777:web:d93b5ca1475efe57'
|
||||
};
|
||||
expect(extractAppConfig(firebaseApp)).to.deep.equal(expected);
|
||||
});
|
||||
|
||||
it('throws if a necessary value is missing', () => {
|
||||
expect(() => extractAppConfig(undefined as any)).to.throw(FirebaseError);
|
||||
|
||||
let firebaseApp = getFakeApp();
|
||||
delete firebaseApp.name;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
|
||||
firebaseApp = getFakeApp();
|
||||
delete firebaseApp.options;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
|
||||
firebaseApp = getFakeApp();
|
||||
delete firebaseApp.options.projectId;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
|
||||
firebaseApp = getFakeApp();
|
||||
delete firebaseApp.options.apiKey;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
|
||||
firebaseApp = getFakeApp();
|
||||
delete firebaseApp.options.appId;
|
||||
expect(() => extractAppConfig(firebaseApp)).to.throw(FirebaseError);
|
||||
});
|
||||
});
|
||||
35
node_modules/@firebase/installations/src/helpers/extract-app-config.ts
generated
vendored
Normal file
35
node_modules/@firebase/installations/src/helpers/extract-app-config.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FirebaseApp } from '@firebase/app-types';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
|
||||
export function extractAppConfig(app: FirebaseApp): AppConfig {
|
||||
if (!app || !app.options) {
|
||||
throw ERROR_FACTORY.create(ErrorCode.MISSING_APP_CONFIG_VALUES);
|
||||
}
|
||||
|
||||
const appName = app.name;
|
||||
const { projectId, apiKey, appId } = app.options;
|
||||
|
||||
if (!appName || !projectId || !apiKey || !appId) {
|
||||
throw ERROR_FACTORY.create(ErrorCode.MISSING_APP_CONFIG_VALUES);
|
||||
}
|
||||
|
||||
return { appName, projectId, apiKey, appId };
|
||||
}
|
||||
128
node_modules/@firebase/installations/src/helpers/generate-fid.test.ts
generated
vendored
Normal file
128
node_modules/@firebase/installations/src/helpers/generate-fid.test.ts
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { expect } from 'chai';
|
||||
import { stub } from 'sinon';
|
||||
import '../testing/setup';
|
||||
import { generateFid, VALID_FID_PATTERN } from './generate-fid';
|
||||
|
||||
/** A few random values to generate a FID from. */
|
||||
// prettier-ignore
|
||||
const MOCK_RANDOM_VALUES = [
|
||||
[14, 107, 44, 183, 190, 84, 253, 45, 219, 233, 43, 190, 240, 152, 195, 222, 237],
|
||||
[184, 251, 91, 157, 125, 225, 209, 15, 116, 66, 46, 113, 194, 126, 16, 13, 226],
|
||||
[197, 123, 13, 142, 239, 129, 252, 139, 156, 36, 219, 192, 153, 52, 182, 231, 177],
|
||||
[69, 154, 197, 91, 156, 196, 125, 111, 3, 67, 212, 132, 169, 11, 14, 254, 125],
|
||||
[193, 102, 58, 19, 244, 69, 36, 135, 170, 106, 98, 216, 246, 209, 24, 155, 149],
|
||||
[252, 59, 222, 160, 82, 160, 82, 186, 14, 172, 196, 114, 146, 191, 196, 194, 146],
|
||||
[64, 147, 153, 236, 225, 142, 235, 109, 184, 249, 174, 127, 33, 238, 227, 172, 111],
|
||||
[129, 137, 136, 120, 248, 206, 253, 78, 159, 201, 216, 15, 246, 80, 118, 185, 211],
|
||||
[117, 150, 2, 180, 116, 230, 45, 188, 183, 43, 152, 100, 50, 255, 101, 175, 190],
|
||||
[156, 129, 30, 101, 58, 137, 217, 249, 12, 227, 235, 80, 248, 81, 191, 2, 5],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
|
||||
];
|
||||
|
||||
/** The FIDs that should be generated based on MOCK_RANDOM_VALUES. */
|
||||
const EXPECTED_FIDS = [
|
||||
'fmsst75U_S3b6Su-8JjD3u',
|
||||
'ePtbnX3h0Q90Qi5xwn4QDe',
|
||||
'dXsNju-B_IucJNvAmTS257',
|
||||
'dZrFW5zEfW8DQ9SEqQsO_n',
|
||||
'cWY6E_RFJIeqamLY9tEYm5',
|
||||
'fDveoFKgUroOrMRykr_Ewp',
|
||||
'cJOZ7OGO6224-a5_Ie7jrG',
|
||||
'cYmIePjO_U6fydgP9lB2ud',
|
||||
'dZYCtHTmLby3K5hkMv9lr7',
|
||||
'fIEeZTqJ2fkM4-tQ-FG_Ag',
|
||||
'cAAAAAAAAAAAAAAAAAAAAA',
|
||||
'f_____________________'
|
||||
];
|
||||
|
||||
describe('generateFid', () => {
|
||||
it('deterministically generates FIDs based on crypto.getRandomValues', () => {
|
||||
let randomValueIndex = 0;
|
||||
stub(crypto, 'getRandomValues').callsFake(array => {
|
||||
if (!(array instanceof Uint8Array)) {
|
||||
throw new Error('what');
|
||||
}
|
||||
const values = MOCK_RANDOM_VALUES[randomValueIndex++];
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
array[i] = values[i];
|
||||
}
|
||||
return array;
|
||||
});
|
||||
|
||||
for (const expectedFid of EXPECTED_FIDS) {
|
||||
expect(generateFid()).to.deep.equal(expectedFid);
|
||||
}
|
||||
});
|
||||
|
||||
it('generates valid FIDs', () => {
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
const fid = generateFid();
|
||||
expect(VALID_FID_PATTERN.test(fid)).to.equal(
|
||||
true,
|
||||
`${fid} is not a valid FID`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it('generates FIDs where each character is equally likely to appear in each location', () => {
|
||||
const numTries = 200000;
|
||||
|
||||
const charOccurrencesMapList: Array<Map<string, number>> = new Array(22);
|
||||
for (let i = 0; i < charOccurrencesMapList.length; i++) {
|
||||
charOccurrencesMapList[i] = new Map();
|
||||
}
|
||||
|
||||
for (let i = 0; i < numTries; i++) {
|
||||
const fid = generateFid();
|
||||
|
||||
Array.from(fid).forEach((char, location) => {
|
||||
const map = charOccurrencesMapList[location];
|
||||
map.set(char, (map.get(char) || 0) + 1);
|
||||
});
|
||||
}
|
||||
|
||||
for (let i = 0; i < charOccurrencesMapList.length; i++) {
|
||||
const map = charOccurrencesMapList[i];
|
||||
if (i === 0) {
|
||||
// In the first location only 4 characters (c, d, e, f) are valid.
|
||||
expect(map.size).to.equal(4);
|
||||
} else {
|
||||
// In locations other than the first, all 64 characters are valid.
|
||||
expect(map.size).to.equal(64);
|
||||
}
|
||||
|
||||
Array.from(map.entries()).forEach(([_, occurrence]) => {
|
||||
const expectedOccurrence = numTries / map.size;
|
||||
|
||||
// 10% margin of error
|
||||
expect(occurrence).to.be.above(expectedOccurrence * 0.9);
|
||||
expect(occurrence).to.be.below(expectedOccurrence * 1.1);
|
||||
});
|
||||
}
|
||||
}).timeout(30000);
|
||||
|
||||
it('returns an empty string if FID generation fails', () => {
|
||||
stub(crypto, 'getRandomValues').throws();
|
||||
|
||||
const fid = generateFid();
|
||||
expect(fid).to.equal('');
|
||||
});
|
||||
});
|
||||
55
node_modules/@firebase/installations/src/helpers/generate-fid.ts
generated
vendored
Normal file
55
node_modules/@firebase/installations/src/helpers/generate-fid.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { bufferToBase64UrlSafe } from './buffer-to-base64-url-safe';
|
||||
|
||||
export const VALID_FID_PATTERN = /^[cdef][\w-]{21}$/;
|
||||
export const INVALID_FID = '';
|
||||
|
||||
/**
|
||||
* Generates a new FID using random values from Web Crypto API.
|
||||
* Returns an empty string if FID generation fails for any reason.
|
||||
*/
|
||||
export function generateFid(): string {
|
||||
try {
|
||||
// A valid FID has exactly 22 base64 characters, which is 132 bits, or 16.5
|
||||
// bytes. our implementation generates a 17 byte array instead.
|
||||
const fidByteArray = new Uint8Array(17);
|
||||
const crypto =
|
||||
self.crypto || ((self as unknown) as { msCrypto: Crypto }).msCrypto;
|
||||
crypto.getRandomValues(fidByteArray);
|
||||
|
||||
// Replace the first 4 random bits with the constant FID header of 0b0111.
|
||||
fidByteArray[0] = 0b01110000 + (fidByteArray[0] % 0b00010000);
|
||||
|
||||
const fid = encode(fidByteArray);
|
||||
|
||||
return VALID_FID_PATTERN.test(fid) ? fid : INVALID_FID;
|
||||
} catch {
|
||||
// FID generation errored
|
||||
return INVALID_FID;
|
||||
}
|
||||
}
|
||||
|
||||
/** Converts a FID Uint8Array to a base64 string representation. */
|
||||
function encode(fidByteArray: Uint8Array): string {
|
||||
const b64String = bufferToBase64UrlSafe(fidByteArray);
|
||||
|
||||
// Remove the 23rd character that was added because of the extra 4 bits at the
|
||||
// end of our 17 byte array, and the '=' padding.
|
||||
return b64String.substr(0, 22);
|
||||
}
|
||||
396
node_modules/@firebase/installations/src/helpers/get-installation-entry.test.ts
generated
vendored
Normal file
396
node_modules/@firebase/installations/src/helpers/get-installation-entry.test.ts
generated
vendored
Normal file
@@ -0,0 +1,396 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2019 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AssertionError, expect } from 'chai';
|
||||
import { SinonFakeTimers, SinonStub, stub, useFakeTimers } from 'sinon';
|
||||
import * as createInstallationModule from '../api/create-installation';
|
||||
import { AppConfig } from '../interfaces/app-config';
|
||||
import {
|
||||
InProgressInstallationEntry,
|
||||
RegisteredInstallationEntry,
|
||||
RequestStatus,
|
||||
UnregisteredInstallationEntry
|
||||
} from '../interfaces/installation-entry';
|
||||
import { getFakeAppConfig } from '../testing/get-fake-app';
|
||||
import '../testing/setup';
|
||||
import { ERROR_FACTORY, ErrorCode } from '../util/errors';
|
||||
import { sleep } from '../util/sleep';
|
||||
import * as generateFidModule from './generate-fid';
|
||||
import { getInstallationEntry } from './get-installation-entry';
|
||||
import { get, set } from './idb-manager';
|
||||
|
||||
const FID = 'cry-of-the-black-birds';
|
||||
|
||||
describe('getInstallationEntry', () => {
|
||||
let clock: SinonFakeTimers;
|
||||
let appConfig: AppConfig;
|
||||
let createInstallationSpy: SinonStub<
|
||||
[AppConfig, InProgressInstallationEntry],
|
||||
Promise<RegisteredInstallationEntry>
|
||||
>;
|
||||
|
||||
beforeEach(() => {
|
||||
clock = useFakeTimers();
|
||||
appConfig = getFakeAppConfig();
|
||||
createInstallationSpy = stub(
|
||||
createInstallationModule,
|
||||
'createInstallation'
|
||||
).callsFake(
|
||||
async (_, installationEntry): Promise<RegisteredInstallationEntry> => {
|
||||
await sleep(100); // Request would take some time
|
||||
const registeredInstallationEntry: RegisteredInstallationEntry = {
|
||||
// Returns new FID if client FID is invalid.
|
||||
fid: installationEntry.fid || FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: {
|
||||
requestStatus: RequestStatus.COMPLETED,
|
||||
creationTime: Date.now(),
|
||||
token: 'token',
|
||||
expiresIn: 1_000_000_000
|
||||
}
|
||||
};
|
||||
return registeredInstallationEntry;
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('saves the InstallationEntry in the database before returning it', async () => {
|
||||
const oldDbEntry = await get(appConfig);
|
||||
expect(oldDbEntry).to.be.undefined;
|
||||
|
||||
const { installationEntry } = await getInstallationEntry(appConfig);
|
||||
|
||||
const newDbEntry = await get(appConfig);
|
||||
expect(newDbEntry).to.deep.equal(installationEntry);
|
||||
});
|
||||
|
||||
it('saves the InstallationEntry in the database if app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
const oldDbEntry = await get(appConfig);
|
||||
expect(oldDbEntry).to.be.undefined;
|
||||
|
||||
const { installationEntry } = await getInstallationEntry(appConfig);
|
||||
|
||||
const newDbEntry = await get(appConfig);
|
||||
expect(newDbEntry).to.deep.equal(installationEntry);
|
||||
});
|
||||
|
||||
it('saves the InstallationEntry in the database when registration completes', async () => {
|
||||
const {
|
||||
installationEntry,
|
||||
registrationPromise
|
||||
} = await getInstallationEntry(appConfig);
|
||||
expect(installationEntry.registrationStatus).to.equal(
|
||||
RequestStatus.IN_PROGRESS
|
||||
);
|
||||
expect(registrationPromise).to.be.an.instanceOf(Promise);
|
||||
|
||||
const oldDbEntry = await get(appConfig);
|
||||
expect(oldDbEntry).to.deep.equal(installationEntry);
|
||||
|
||||
clock.next(); // Finish registration request.
|
||||
await expect(registrationPromise).to.be.fulfilled;
|
||||
|
||||
const newDbEntry = (await get(appConfig)) as RegisteredInstallationEntry;
|
||||
expect(newDbEntry.registrationStatus).to.equal(RequestStatus.COMPLETED);
|
||||
});
|
||||
|
||||
it('saves the InstallationEntry in the database when registration fails', async () => {
|
||||
createInstallationSpy.callsFake(async () => {
|
||||
await sleep(100); // Request would take some time
|
||||
throw ERROR_FACTORY.create(ErrorCode.REQUEST_FAILED, {
|
||||
requestName: 'Create Installation',
|
||||
serverCode: 500,
|
||||
serverStatus: 'INTERNAL',
|
||||
serverMessage: 'Internal server error.'
|
||||
});
|
||||
});
|
||||
|
||||
const {
|
||||
installationEntry,
|
||||
registrationPromise
|
||||
} = await getInstallationEntry(appConfig);
|
||||
expect(installationEntry.registrationStatus).to.equal(
|
||||
RequestStatus.IN_PROGRESS
|
||||
);
|
||||
expect(registrationPromise).to.be.an.instanceOf(Promise);
|
||||
|
||||
const oldDbEntry = await get(appConfig);
|
||||
expect(oldDbEntry).to.deep.equal(installationEntry);
|
||||
|
||||
clock.next(); // Finish registration request.
|
||||
await expect(registrationPromise).to.be.rejected;
|
||||
|
||||
const newDbEntry = (await get(appConfig)) as UnregisteredInstallationEntry;
|
||||
expect(newDbEntry.registrationStatus).to.equal(RequestStatus.NOT_STARTED);
|
||||
});
|
||||
|
||||
it('removes the InstallationEntry from the database when registration fails with 409', async () => {
|
||||
createInstallationSpy.callsFake(async () => {
|
||||
await sleep(100); // Request would take some time
|
||||
throw ERROR_FACTORY.create(ErrorCode.REQUEST_FAILED, {
|
||||
requestName: 'Create Installation',
|
||||
serverCode: 409,
|
||||
serverStatus: 'INVALID_ARGUMENT',
|
||||
serverMessage: 'FID can not be used.'
|
||||
});
|
||||
});
|
||||
|
||||
const {
|
||||
installationEntry,
|
||||
registrationPromise
|
||||
} = await getInstallationEntry(appConfig);
|
||||
expect(installationEntry.registrationStatus).to.equal(
|
||||
RequestStatus.IN_PROGRESS
|
||||
);
|
||||
|
||||
const oldDbEntry = await get(appConfig);
|
||||
expect(oldDbEntry).to.deep.equal(installationEntry);
|
||||
|
||||
clock.next(); // Finish registration request.
|
||||
await expect(registrationPromise).to.be.rejected;
|
||||
|
||||
const newDbEntry = await get(appConfig);
|
||||
expect(newDbEntry).to.be.undefined;
|
||||
});
|
||||
|
||||
it('returns the same FID on subsequent calls', async () => {
|
||||
const { installationEntry: entry1 } = await getInstallationEntry(appConfig);
|
||||
const { installationEntry: entry2 } = await getInstallationEntry(appConfig);
|
||||
expect(entry1.fid).to.equal(entry2.fid);
|
||||
});
|
||||
|
||||
describe('when there is no InstallationEntry in database', () => {
|
||||
let generateInstallationEntrySpy: SinonStub<[], string>;
|
||||
|
||||
beforeEach(() => {
|
||||
generateInstallationEntrySpy = stub(
|
||||
generateFidModule,
|
||||
'generateFid'
|
||||
).returns(FID);
|
||||
});
|
||||
|
||||
it('returns a new pending InstallationEntry and triggers createInstallation', async () => {
|
||||
const {
|
||||
installationEntry,
|
||||
registrationPromise
|
||||
} = await getInstallationEntry(appConfig);
|
||||
|
||||
if (installationEntry.registrationStatus !== RequestStatus.IN_PROGRESS) {
|
||||
throw new AssertionError('InstallationEntry is not IN_PROGRESS.');
|
||||
}
|
||||
|
||||
expect(registrationPromise).to.be.an.instanceOf(Promise);
|
||||
expect(installationEntry).to.deep.equal({
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
|
||||
// https://github.com/chaijs/chai/issues/644
|
||||
registrationTime: installationEntry.registrationTime
|
||||
});
|
||||
expect(generateInstallationEntrySpy).to.be.called;
|
||||
expect(createInstallationSpy).to.be.called;
|
||||
});
|
||||
|
||||
it('returns a new unregistered InstallationEntry if app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
const { installationEntry } = await getInstallationEntry(appConfig);
|
||||
|
||||
expect(installationEntry).to.deep.equal({
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
});
|
||||
expect(generateInstallationEntrySpy).to.be.called;
|
||||
expect(createInstallationSpy).not.to.be.called;
|
||||
});
|
||||
|
||||
it('does not trigger createInstallation REST call on subsequent calls', async () => {
|
||||
await getInstallationEntry(appConfig);
|
||||
await getInstallationEntry(appConfig);
|
||||
|
||||
expect(createInstallationSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('returns a registrationPromise on subsequent calls before initial promise resolves', async () => {
|
||||
const { registrationPromise: promise1 } = await getInstallationEntry(
|
||||
appConfig
|
||||
);
|
||||
const { registrationPromise: promise2 } = await getInstallationEntry(
|
||||
appConfig
|
||||
);
|
||||
|
||||
expect(createInstallationSpy).to.be.calledOnce;
|
||||
expect(promise1).to.be.an.instanceOf(Promise);
|
||||
expect(promise2).to.be.an.instanceOf(Promise);
|
||||
});
|
||||
|
||||
it('does not return a registrationPromise on subsequent calls after initial promise resolves', async () => {
|
||||
const { registrationPromise: promise1 } = await getInstallationEntry(
|
||||
appConfig
|
||||
);
|
||||
expect(promise1).to.be.an.instanceOf(Promise);
|
||||
|
||||
clock.next(); // Finish registration request.
|
||||
await expect(promise1).to.be.fulfilled;
|
||||
|
||||
const { registrationPromise: promise2 } = await getInstallationEntry(
|
||||
appConfig
|
||||
);
|
||||
expect(promise2).to.be.undefined;
|
||||
|
||||
expect(createInstallationSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('waits for the FID from the server if FID generation fails', async () => {
|
||||
clock.restore();
|
||||
// Needed to allow the createInstallation request to complete.
|
||||
clock = useFakeTimers({ shouldAdvanceTime: true });
|
||||
|
||||
// FID generation fails.
|
||||
generateInstallationEntrySpy.returns(generateFidModule.INVALID_FID);
|
||||
|
||||
const getInstallationEntryPromise = getInstallationEntry(appConfig);
|
||||
|
||||
const {
|
||||
installationEntry,
|
||||
registrationPromise
|
||||
} = await getInstallationEntryPromise;
|
||||
|
||||
expect(installationEntry.fid).to.equal(FID);
|
||||
expect(registrationPromise).to.be.undefined;
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is an unregistered InstallationEntry in the database', () => {
|
||||
beforeEach(async () => {
|
||||
const unregisteredInstallationEntry: UnregisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
};
|
||||
await set(appConfig, unregisteredInstallationEntry);
|
||||
});
|
||||
|
||||
it('returns a pending InstallationEntry and triggers createInstallation', async () => {
|
||||
const {
|
||||
installationEntry,
|
||||
registrationPromise
|
||||
} = await getInstallationEntry(appConfig);
|
||||
|
||||
if (installationEntry.registrationStatus !== RequestStatus.IN_PROGRESS) {
|
||||
throw new AssertionError('InstallationEntry is not IN_PROGRESS.');
|
||||
}
|
||||
|
||||
expect(registrationPromise).to.be.an.instanceOf(Promise);
|
||||
expect(installationEntry).to.deep.equal({
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
// https://github.com/chaijs/chai/issues/644
|
||||
registrationTime: installationEntry.registrationTime
|
||||
});
|
||||
expect(createInstallationSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('returns the same InstallationEntry if the app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
|
||||
const { installationEntry } = await getInstallationEntry(appConfig);
|
||||
|
||||
expect(installationEntry).to.deep.equal({
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
});
|
||||
expect(createInstallationSpy).not.to.be.called;
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is a pending InstallationEntry in the database', () => {
|
||||
beforeEach(async () => {
|
||||
const inProgressInstallationEntry: InProgressInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: 1_000_000
|
||||
};
|
||||
await set(appConfig, inProgressInstallationEntry);
|
||||
});
|
||||
|
||||
it("returns the same InstallationEntry if the request hasn't timed out", async () => {
|
||||
stub(Date, 'now').returns(1_001_000); // One second later
|
||||
|
||||
const { installationEntry } = await getInstallationEntry(appConfig);
|
||||
|
||||
expect(installationEntry).to.deep.equal({
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: 1_000_000
|
||||
});
|
||||
expect(createInstallationSpy).not.to.be.called;
|
||||
});
|
||||
|
||||
it('returns a new pending InstallationEntry and triggers createInstallation if the request timed out', async () => {
|
||||
stub(Date, 'now').returns(1_015_000); // Fifteen seconds later
|
||||
|
||||
const { installationEntry } = await getInstallationEntry(appConfig);
|
||||
|
||||
expect(installationEntry).to.deep.equal({
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.IN_PROGRESS,
|
||||
registrationTime: 1_015_000
|
||||
});
|
||||
expect(createInstallationSpy).to.be.calledOnce;
|
||||
});
|
||||
|
||||
it('returns a new unregistered InstallationEntry if the request timed out and the app is offline', async () => {
|
||||
stub(navigator, 'onLine').value(false);
|
||||
stub(Date, 'now').returns(1_015_000); // Fifteen seconds later
|
||||
|
||||
const { installationEntry } = await getInstallationEntry(appConfig);
|
||||
|
||||
expect(installationEntry).to.deep.equal({
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.NOT_STARTED
|
||||
});
|
||||
expect(createInstallationSpy).not.to.be.called;
|
||||
});
|
||||
});
|
||||
|
||||
describe('when there is a registered InstallationEntry in the database', () => {
|
||||
beforeEach(async () => {
|
||||
const registeredInstallationEntry: RegisteredInstallationEntry = {
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: { requestStatus: RequestStatus.NOT_STARTED }
|
||||
};
|
||||
await set(appConfig, registeredInstallationEntry);
|
||||
});
|
||||
|
||||
it('returns the InstallationEntry from the database', async () => {
|
||||
const { installationEntry } = await getInstallationEntry(appConfig);
|
||||
|
||||
expect(installationEntry).to.deep.equal({
|
||||
fid: FID,
|
||||
registrationStatus: RequestStatus.COMPLETED,
|
||||
refreshToken: 'refreshToken',
|
||||
authToken: { requestStatus: RequestStatus.NOT_STARTED }
|
||||
});
|
||||
expect(createInstallationSpy).not.to.be.called;
|
||||
});
|
||||
});
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user