add failing test for unsubscribe using wrong handler
This commit is contained in:
parent
9b94c4bb61
commit
0cf7cb36c4
1 changed files with 23 additions and 0 deletions
|
@ -30,3 +30,26 @@ export default class BaseObservableCollection {
|
||||||
|
|
||||||
// Add iterator over handlers here
|
// Add iterator over handlers here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function tests() {
|
||||||
|
class Collection extends BaseObservableCollection {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.firstSubscribeCalls = 0;
|
||||||
|
this.firstUnsubscribeCalls = 0;
|
||||||
|
}
|
||||||
|
onSubscribeFirst() { this.firstSubscribeCalls += 1; }
|
||||||
|
onUnsubscribeLast() { this.firstUnsubscribeCalls += 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
test_unsubscribe(assert) {
|
||||||
|
const c = new Collection();
|
||||||
|
const subscription = c.subscribe({});
|
||||||
|
// unsubscribe
|
||||||
|
subscription();
|
||||||
|
assert.equal(c.firstSubscribeCalls, 1);
|
||||||
|
assert.equal(c.firstUnsubscribeCalls, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in a new issue