Fix broken tests
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
8e39aed4b6
commit
2502c4024a
2 changed files with 14 additions and 4 deletions
|
@ -189,6 +189,8 @@ import {HomeServer as MockHomeServer} from "../../../../mocks/HomeServer.js";
|
|||
// other imports
|
||||
import {BaseMessageTile} from "./tiles/BaseMessageTile.js";
|
||||
import {MappedList} from "../../../../observable/list/MappedList.js";
|
||||
import {ObservableValue} from "../../../../observable/ObservableValue.js";
|
||||
import {PowerLevels} from "../../../../matrix/room/timeline/PowerLevels.js";
|
||||
|
||||
export function tests() {
|
||||
const fragmentIdComparer = new FragmentIdComparer([]);
|
||||
|
@ -251,8 +253,9 @@ export function tests() {
|
|||
await txn.complete();
|
||||
// 2. setup queue & timeline
|
||||
const queue = new SendQueue({roomId, storage, hsApi: new MockHomeServer().api});
|
||||
const powerLevelsObservable = new ObservableValue(new PowerLevels({ ownUserId: alice, membership: "join" }));
|
||||
const timeline = new Timeline({roomId, storage, fragmentIdComparer,
|
||||
clock: new MockClock(), pendingEvents: queue.pendingEvents});
|
||||
clock: new MockClock(), pendingEvents: queue.pendingEvents, powerLevelsObservable});
|
||||
// 3. load the timeline, which will load the message with the reaction
|
||||
await timeline.load(new User(alice), "join", new NullLogItem());
|
||||
const tiles = mapMessageEntriesToBaseMessageTile(timeline, queue);
|
||||
|
@ -310,8 +313,9 @@ export function tests() {
|
|||
await txn.complete();
|
||||
// 2. setup queue & timeline
|
||||
const queue = new SendQueue({roomId, storage, hsApi: new MockHomeServer().api});
|
||||
const powerLevelsObservable = new ObservableValue(new PowerLevels({ ownUserId: alice, membership: "join" }));
|
||||
const timeline = new Timeline({roomId, storage, fragmentIdComparer,
|
||||
clock: new MockClock(), pendingEvents: queue.pendingEvents});
|
||||
clock: new MockClock(), pendingEvents: queue.pendingEvents, powerLevelsObservable});
|
||||
|
||||
// 3. load the timeline, which will load the message with the reaction
|
||||
await timeline.load(new User(alice), "join", new NullLogItem());
|
||||
|
|
|
@ -43,8 +43,14 @@ export class Timeline {
|
|||
});
|
||||
this._readerRequest = null;
|
||||
this._allEntries = null;
|
||||
this._powerLevels = powerLevelsObservable.get();
|
||||
this._disposables.track(powerLevelsObservable.subscribe(powerLevels => this._powerLevels = powerLevels));
|
||||
this.initializePowerLevels(powerLevelsObservable);
|
||||
}
|
||||
|
||||
initializePowerLevels(observable) {
|
||||
if (observable) {
|
||||
this._powerLevels = observable.get();
|
||||
this._disposables.track(observable.subscribe(powerLevels => this._powerLevels = powerLevels));
|
||||
}
|
||||
}
|
||||
|
||||
/** @package */
|
||||
|
|
Reference in a new issue