mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
fix ts errors in TimelineEventStore unit tests
This commit is contained in:
parent
ec2f1b9833
commit
e31d3abc97
@ -320,6 +320,7 @@ export class TimelineEventStore {
|
|||||||
import {createMockStorage} from "../../../../mocks/Storage";
|
import {createMockStorage} from "../../../../mocks/Storage";
|
||||||
import {createEvent, withTextBody} from "../../../../mocks/event.js";
|
import {createEvent, withTextBody} from "../../../../mocks/event.js";
|
||||||
import {createEventEntry} from "../../../room/timeline/persistence/common.js";
|
import {createEventEntry} from "../../../room/timeline/persistence/common.js";
|
||||||
|
import {Instance as logItem} from "../../../../logging/NullLogger.js";
|
||||||
|
|
||||||
export function tests() {
|
export function tests() {
|
||||||
|
|
||||||
@ -366,15 +367,16 @@ export function tests() {
|
|||||||
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents]);
|
const txn = await storage.readWriteTxn([storage.storeNames.timelineEvents]);
|
||||||
let eventKey = EventKey.defaultFragmentKey(109);
|
let eventKey = EventKey.defaultFragmentKey(109);
|
||||||
for (const insertedId of insertedIds) {
|
for (const insertedId of insertedIds) {
|
||||||
assert(await txn.timelineEvents.tryInsert(createEventEntry(eventKey.nextKey(), roomId, createEventWithId(insertedId))));
|
const entry = createEventEntry(eventKey.nextKey(), roomId, createEventWithId(insertedId));
|
||||||
|
assert(await txn.timelineEvents.tryInsert(entry, logItem));
|
||||||
eventKey = eventKey.nextKey();
|
eventKey = eventKey.nextKey();
|
||||||
}
|
}
|
||||||
const eventKeyMap = await txn.timelineEvents.getEventKeysForIds(roomId, checkedIds);
|
const eventKeyMap = await txn.timelineEvents.getEventKeysForIds(roomId, checkedIds);
|
||||||
assert.equal(eventKeyMap.size, 2);
|
assert.equal(eventKeyMap.size, 2);
|
||||||
const eventKey1 = eventKeyMap.get("$Oil2Afq2cBLqMAeJTAHjA3Is9T5Wmaa2ogVRlFJ_gzE");
|
const eventKey1 = eventKeyMap.get("$Oil2Afq2cBLqMAeJTAHjA3Is9T5Wmaa2ogVRlFJ_gzE")!;
|
||||||
assert.equal(eventKey1.fragmentId, 109);
|
assert.equal(eventKey1.fragmentId, 109);
|
||||||
assert.equal(eventKey1.eventIndex, 0x80000001);
|
assert.equal(eventKey1.eventIndex, 0x80000001);
|
||||||
const eventKey2 = eventKeyMap.get("$vdLgAnwjHj0cicU3MA4ynLHUBGOIFhvvksY3loqzjF");
|
const eventKey2 = eventKeyMap.get("$vdLgAnwjHj0cicU3MA4ynLHUBGOIFhvvksY3loqzjF")!;
|
||||||
assert.equal(eventKey2.fragmentId, 109);
|
assert.equal(eventKey2.fragmentId, 109);
|
||||||
assert.equal(eventKey2.eventIndex, 0x80000002);
|
assert.equal(eventKey2.eventIndex, 0x80000002);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user