@@ -25,20 +25,19 @@ import { MockChannel } from "./mocks/channel";
2525import { IMatrixEvent } from "../src/matrixtypes" ;
2626import { AppserviceMock } from "./mocks/appservicemock" ;
2727import { Appservice } from "matrix-bot-sdk" ;
28- import { RemoteStoreRoom } from "../src/db/roomstore" ;
2928
3029// we are a test file and thus need those
3130/* tslint:disable:no-unused-expression max-file-line-count no-any */
3231
3332const TEST_TIMESTAMP = 1337 ;
3433
3534function buildRequest ( eventData ) : IMatrixEvent {
36- if ( eventData . unsigned === undefined ) {
37- eventData . unsigned = { age : 0 } ;
38- }
3935 if ( eventData . sender === undefined ) {
4036 eventData . sender = "@foobar:localhost" ;
4137 }
38+ if ( ! eventData . origin_server_ts ) {
39+ eventData . origin_server_ts = Date . now ( ) ;
40+ }
4241 return eventData ;
4342}
4443
@@ -378,7 +377,6 @@ describe("MatrixEventProcessor", () => {
378377 } ,
379378 sender : "@user:localhost" ,
380379 type : "m.room.member" ,
381- unsigned : { } ,
382380 } as IMatrixEvent ;
383381 await processor . ProcessStateEvent ( event ) ;
384382 expect ( STATE_EVENT_MSG ) . to . equal ( "`@user:localhost` joined the room on Matrix." ) ;
@@ -407,7 +405,6 @@ describe("MatrixEventProcessor", () => {
407405 sender : "@user:localhost" ,
408406 state_key : "@user2:localhost" ,
409407 type : "m.room.member" ,
410- unsigned : { } ,
411408 } as IMatrixEvent ;
412409 await processor . ProcessStateEvent ( event ) ;
413410 expect ( STATE_EVENT_MSG ) . to . equal ( "`@user:localhost` invited `@user2:localhost` to the room on Matrix." ) ;
@@ -437,7 +434,6 @@ describe("MatrixEventProcessor", () => {
437434 sender : "@user:localhost" ,
438435 state_key : "@user2:localhost" ,
439436 type : "m.room.member" ,
440- unsigned : { } ,
441437 } as IMatrixEvent ;
442438 await processor . ProcessStateEvent ( event ) ;
443439 expect ( STATE_EVENT_MSG ) . to . equal ( "`@user:localhost` kicked `@user2:localhost` from the room on Matrix." ) ;
@@ -451,7 +447,6 @@ describe("MatrixEventProcessor", () => {
451447 sender : "@user:localhost" ,
452448 state_key : "@user:localhost" ,
453449 type : "m.room.member" ,
454- unsigned : { } ,
455450 } as IMatrixEvent ;
456451 await processor . ProcessStateEvent ( event ) ;
457452 expect ( STATE_EVENT_MSG ) . to . equal ( "`@user:localhost` left the room on Matrix." ) ;
@@ -481,7 +476,6 @@ describe("MatrixEventProcessor", () => {
481476 sender : "@user:localhost" ,
482477 state_key : "@user2:localhost" ,
483478 type : "m.room.member" ,
484- unsigned : { } ,
485479 } as IMatrixEvent ;
486480 await processor . ProcessStateEvent ( event ) ;
487481 expect ( STATE_EVENT_MSG ) . to . equal ( "`@user:localhost` banned `@user2:localhost` from the room on Matrix." ) ;
@@ -971,21 +965,19 @@ This is the reply`,
971965 const { processor} = createMatrixEventProcessor ( ) ;
972966 let err ;
973967 try {
974- await processor . OnEvent ( buildRequest ( { unsigned : { age : AGE } } ) , [ ] ) ;
968+ await processor . OnEvent ( buildRequest ( { origin_server_ts : Date . now ( ) - AGE } ) , [ ] ) ;
975969 } catch ( e ) { err = e ; }
976970 // TODO: Not supported yet.
977971 // expect(err).to.be.an.instanceof(Unstable.EventTooOldError);
978972 } ) ;
979973 it ( "should reject un-processable events" , async ( ) => {
980- const AGE = 900000 ; // 15 * 60 * 1000
981974 const { processor} = createMatrixEventProcessor ( ) ;
982975 let err ;
983976 try {
984977 await processor . OnEvent (
985978 buildRequest ( {
986979 content : { } ,
987980 type : "m.potato" ,
988- unsigned : { age : AGE } ,
989981 } ) ,
990982 [ ] ,
991983 ) ;
0 commit comments