Achieve 100% coverage
This commit is contained in:
Родитель
aa93a355aa
Коммит
4f835ca2e6
9
index.js
9
index.js
|
@ -98,13 +98,8 @@ class RefreshingConfig extends EventEmitter {
|
|||
return this.store.getAll()
|
||||
.then(newConfig => {
|
||||
const configPatch = patch.compare(self.config, newConfig);
|
||||
for (let i = 0; i < configPatch.length; i++) {
|
||||
const value = configPatch[i];
|
||||
if (value.op === 'remove' && value.path === '/_emitter') {
|
||||
configPatch.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
const emitterPatchIndex = configPatch.findIndex(patch => patch.path === '/_emitter');
|
||||
configPatch.splice(emitterPatchIndex, 1);
|
||||
if (configPatch.length !== 0) {
|
||||
patch.apply(self.config, configPatch);
|
||||
self.emit('changed', self.config, configPatch);
|
||||
|
|
|
@ -145,7 +145,7 @@ describe('RefreshingConfig', () => {
|
|||
});
|
||||
it('notifies subscribers of changes', () => {
|
||||
const firstResponse = { foo: 'bar' };
|
||||
const secondResponse = { foo: 'bar', hello: 'world', qwer: 'ty' };
|
||||
const secondResponse = { foo: 'bar', hello: 'world', _a: 'b' };
|
||||
const getAllStub = sinon.stub();
|
||||
getAllStub.onFirstCall().returns(Q(firstResponse));
|
||||
getAllStub.onSecondCall().returns(Q(secondResponse));
|
||||
|
|
Загрузка…
Ссылка в новой задаче