Improve coverage
This commit is contained in:
Родитель
8e39858016
Коммит
aa93a355aa
16
index.js
16
index.js
|
@ -81,10 +81,10 @@ class RefreshingConfig extends EventEmitter {
|
|||
if (!extension) {
|
||||
return this;
|
||||
}
|
||||
if (typeof (extension['subscribe']) === 'function' || typeof (extension['shouldRefresh']) === 'function') {
|
||||
if (typeof (extension['subscribe']) === 'function') {
|
||||
extension.subscribe(this);
|
||||
}
|
||||
if (typeof (extension['subscribe']) === 'function') {
|
||||
extension.subscribe(this);
|
||||
}
|
||||
if (typeof (extension['shouldRefresh']) === 'function') {
|
||||
this.refreshPolicies.push(extension);
|
||||
}
|
||||
if (typeof (extension['publish']) === 'function') {
|
||||
|
@ -121,11 +121,9 @@ class RefreshingConfig extends EventEmitter {
|
|||
if (!shouldRefresh) {
|
||||
for (let i = 0; i < this.refreshPolicies.length; i++) {
|
||||
const refreshPolicy = this.refreshPolicies[i];
|
||||
if (typeof (refreshPolicy['shouldRefresh']) === 'function') {
|
||||
if (refreshPolicy.shouldRefresh()) {
|
||||
shouldRefresh = true;
|
||||
break;
|
||||
}
|
||||
if (refreshPolicy.shouldRefresh()) {
|
||||
shouldRefresh = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,4 +291,8 @@ describe('IntervalRefreshPolicy', () => {
|
|||
target.subscribe({});
|
||||
}).should.throw(Error, /already subscribed/i);
|
||||
});
|
||||
it('does not throw if you unsubscribe when not subscribed', () => {
|
||||
const target = new config.RefreshPolicy.IntervalRefreshPolicy(1000);
|
||||
target.unsubscribe();
|
||||
});
|
||||
});
|
Загрузка…
Ссылка в новой задаче