1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-09-01 21:21:58 +03:00

Add another storeRoom test. Add stub tests for WebStorage.

This commit is contained in:
Kegan Dougal
2015-07-01 12:03:34 +01:00
parent 2d08a6530c
commit 994fcceace
2 changed files with 65 additions and 4 deletions

View File

@@ -282,7 +282,7 @@ function SerialisedRoom(roomId) {
*/
SerialisedRoom.fromRoom = function(room, batchSize) {
var self = new SerialisedRoom(room.roomId);
var i, ptr;
var ptr;
self.state.pagination_token = room.oldState.paginationToken;
// [room_$ROOMID_state] downcast to POJO from MatrixEvent
utils.forEach(utils.keys(room.currentState.events), function(eventType) {
@@ -303,7 +303,7 @@ SerialisedRoom.fromRoom = function(room, batchSize) {
self.timeline[ptr] = room.timeline.slice(
ptr * batchSize, (ptr + 1) * batchSize
);
self.timeline[ptr] = utils.map(self.timeline[ptr][i], function(me) {
self.timeline[ptr] = utils.map(self.timeline[ptr], function(me) {
// use POJO not MatrixEvent
return me.event;
});
@@ -363,7 +363,7 @@ function loadRoom(store, roomId, numEvents) {
function persist(store, serRoom) {
store.setItem(keyName(serRoom.roomId, "state"), serRoom.state);
utils.keys(serRoom.timeline, function(index) {
utils.forEach(utils.keys(serRoom.timeline), function(index) {
store.setItem(
keyName(serRoom.roomId, "timeline", index),
serRoom.timeline[index]