mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
add failing test for unsubscribe using wrong handler
This commit is contained in:
parent
9b94c4bb61
commit
0cf7cb36c4
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user