File tree Expand file tree Collapse file tree 6 files changed +7
-10
lines changed Expand file tree Collapse file tree 6 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -88,12 +88,13 @@ export class MjolnirAppService {
8888 * @param config The parsed configuration file.
8989 * @param registrationFilePath A path to their homeserver registration file.
9090 */
91- public static async run ( port : number , config : IConfig , registrationFilePath : string ) {
91+ public static async run ( port : number , config : IConfig , registrationFilePath : string ) : Promise < MjolnirAppService > {
9292 const dataStore = new PgDataStore ( config . db . connectionString ) ;
9393 await dataStore . init ( ) ;
9494 const service = await MjolnirAppService . makeMjolnirAppService ( config , dataStore , registrationFilePath ) ;
9595 // The call to `start` MUST happen last. As it needs the datastore, and the mjolnir manager to be initialized before it can process events from the homeserver.
9696 await service . start ( port ) ;
97+ return service ;
9798 }
9899
99100 public onUserQuery ( queriedUser : MatrixUser ) {
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ describe("Test that the app service can provision a mjolnir on invite of the app
1616 return this . appservice . close ( ) ;
1717 } else {
1818 console . warn ( "Missing Appservice in this context, so cannot stop it." )
19+ return Promise . resolve ( ) ; // TS7030: Not all code paths return a value.
1920 }
2021 } ) ;
2122 it ( "A moderator that requests a mjolnir via a matrix invitation will be invited to a new policy and management room" , async function ( this : Context ) {
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ describe("Test that the app service can provision a mjolnir when requested from
2020 return this . appservice . close ( ) ;
2121 } else {
2222 console . warn ( "Missing Appservice in this context, so cannot stop it." )
23+ return Promise . resolve ( ) ; // TS7030: Not all code paths return a value.
2324 }
2425 } ) ;
2526 it ( "A moderator that requests a mjolnir via a matrix invitation will be invited to a new policy and management room" , async function ( this : Context ) {
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import path from "path";
22import { MjolnirAppService } from "../../../src/appservice/AppService" ;
33import { ensureAliasedRoomExists } from "../../integration/mjolnirSetupUtils" ;
44import { read as configRead , IConfig } from "../../../src/appservice/config/config" ;
5- import { PgDataStore } from "../../../src/appservice/datastore" ;
65import { newTestUser } from "../../integration/clientHelper" ;
76import PolicyList from "../../../src/models/PolicyList" ;
87import { CreateEvent , MatrixClient } from "matrix-bot-sdk" ;
@@ -15,11 +14,7 @@ export async function setupHarness(): Promise<MjolnirAppService> {
1514 const config = readTestConfig ( ) ;
1615 const utilityUser = await newTestUser ( config . homeserver . url , { name : { contains : "utility" } } ) ;
1716 await ensureAliasedRoomExists ( utilityUser , config . accessControlList ) ;
18- const dataStore = new PgDataStore ( config . db . connectionString ) ;
19- await dataStore . init ( ) ;
20- const appservice = await MjolnirAppService . makeMjolnirAppService ( config , dataStore , "mjolnir-registration.yaml" ) ;
21- await appservice . start ( 9000 ) ;
22- return appservice ;
17+ return await MjolnirAppService . run ( 9000 , config , "mjolnir-registration.yaml" ) ;
2318}
2419
2520export async function isPolicyRoom ( user : MatrixClient , roomId : string ) : Promise < boolean > {
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ export interface CreateMjolnirResponse {
2121export class MjolnirWebAPIClient {
2222
2323 private constructor (
24- private readonly matrixClient : MatrixClient ,
2524 private readonly openIDToken : string ,
2625 private readonly baseURL : string ,
2726 ) {
@@ -30,7 +29,7 @@ export class MjolnirWebAPIClient {
3029
3130 public static async makeClient ( client : MatrixClient , baseUrl : string ) : Promise < MjolnirWebAPIClient > {
3231 const token = await getOpenIDToken ( client ) ;
33- return new MjolnirWebAPIClient ( client , token , baseUrl ) ;
32+ return new MjolnirWebAPIClient ( token , baseUrl ) ;
3433 }
3534
3635 public async createMjolnir ( roomToProtectId : string ) : Promise < CreateMjolnirResponse > {
Original file line number Diff line number Diff line change 2121 },
2222 "include" : [
2323 " ./src/**/*" ,
24- " ./test/appservice/*" ,
24+ " ./test/appservice/**/* " ,
2525 " ./test/integration/manualLaunchScript.ts" ,
2626 " ./test/integration/roomMembersTest.ts" ,
2727 " ./test/integration/banListTest.ts" ,
You can’t perform that action at this time.
0 commit comments