Skip to content

Commit

Permalink
chore: fixing deprecated subscribe and tap calls (#6740)
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh authored Jan 11, 2022
1 parent 7fd0575 commit c0ed6c5
Show file tree
Hide file tree
Showing 63 changed files with 947 additions and 1,114 deletions.
105 changes: 41 additions & 64 deletions spec/Observable-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ describe('Observable', () => {
});

source.subscribe(
function (x) {
{ next: function (x) {
expect(x).to.equal(1);
},
null,
done
}, complete: done }
);
});

Expand Down Expand Up @@ -211,15 +209,13 @@ describe('Observable', () => {
let mutatedByComplete = false;

source.subscribe(
(x) => {
{ next: (x) => {
nexted = x;
mutatedByNext = true;
},
null,
() => {
}, complete: () => {
completed = true;
mutatedByComplete = true;
}
} }
);

expect(mutatedByNext).to.be.true;
Expand Down Expand Up @@ -382,14 +378,13 @@ describe('Observable', () => {
})
.pipe(tap(() => (times += 1)))
.subscribe(
function () {
{ next: function () {
if (times === 2) {
subscription.unsubscribe();
}
},
function () {
}, error: function () {
errorCalled = true;
}
} }
);
});

Expand All @@ -415,15 +410,13 @@ describe('Observable', () => {
})
.pipe(tap(() => (times += 1)))
.subscribe(
function () {
{ next: function () {
if (times === 2) {
subscription.unsubscribe();
}
},
null,
function () {
}, complete: function () {
completeCalled = true;
}
} }
);
});

Expand Down Expand Up @@ -847,11 +840,9 @@ describe('Observable', () => {
map((x) => x + '!!!')
)
.subscribe(
(x) => {
{ next: (x) => {
expect(x).to.equal('testtest!!!');
},
null,
done
}, complete: done }
);
});

Expand Down Expand Up @@ -1006,15 +997,13 @@ describe('Observable.lift', () => {
const expected = [10, 20, 30];

result.subscribe(
function (x) {
{ next: function (x) {
expect(x).to.equal(expected.shift());
},
() => {
}, error: () => {
done(new Error('should not be called'));
},
() => {
}, complete: () => {
done();
}
} }
);
});

Expand All @@ -1035,15 +1024,13 @@ describe('Observable.lift', () => {
const expected = [10, 20, 30];

result.subscribe(
function (x) {
{ next: function (x) {
expect(x).to.equal(expected.shift());
},
() => {
}, error: () => {
done(new Error('should not be called'));
},
() => {
}, complete: () => {
done();
}
} }
);
});

Expand All @@ -1065,15 +1052,13 @@ describe('Observable.lift', () => {
const expected = [10, 20, 30];

result.subscribe(
function (x) {
{ next: function (x) {
expect(x).to.equal(expected.shift());
},
() => {
}, error: () => {
done(new Error('should not be called'));
},
() => {
}, complete: () => {
done();
}
} }
);
});

Expand All @@ -1095,15 +1080,13 @@ describe('Observable.lift', () => {
const expected = [30];

result.subscribe(
function (x) {
{ next: function (x) {
expect(x).to.equal(expected.shift());
},
() => {
}, error: () => {
done(new Error('should not be called'));
},
() => {
}, complete: () => {
done();
}
} }
);
});

Expand All @@ -1124,15 +1107,13 @@ describe('Observable.lift', () => {
const expected = [0, 10, 20, 30];

result.subscribe(
function (x) {
{ next: function (x) {
expect(x).to.equal(expected.shift());
},
() => {
}, error: () => {
done(new Error('should not be called'));
},
() => {
}, complete: () => {
done();
}
} }
);
});

Expand Down Expand Up @@ -1308,15 +1289,13 @@ describe('Observable.lift', () => {
const expected = [10, 20, 30];

result.subscribe(
function (x) {
{ next: function (x) {
expect(x).to.equal(expected.shift());
},
() => {
}, error: () => {
done(new Error('should not be called'));
},
() => {
}, complete: () => {
done();
}
} }
);
});

Expand Down Expand Up @@ -1458,13 +1437,11 @@ describe('Observable.lift', () => {
const expected = [2];

result.subscribe(
function (x) {
{ next: function (x) {
expect(x).to.equal(expected.shift());
},
() => {
}, error: () => {
done(new Error('should not be called'));
},
() => {
}, complete: () => {
expect(log).to.deep.equal([
'next 10', // map
'next 20', // map
Expand All @@ -1474,7 +1451,7 @@ describe('Observable.lift', () => {
'next 2', // count
]);
done();
}
} }
);
});
});
Loading

0 comments on commit c0ed6c5

Please sign in to comment.