From a7f55283b52ae07d8b1d1bdecbbfd3c63ad3e4c9 Mon Sep 17 00:00:00 2001 From: Niek Candaele <22315101+niekcandaele@users.noreply.github.com> Date: Tue, 18 Aug 2020 21:55:35 +0200 Subject: [PATCH] Fix some errors in ban service (#91) --- src/ban/ban.service.ts | 4 ++-- src/match/demo.spec.ts | 28 ++++------------------------ 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/ban/ban.service.ts b/src/ban/ban.service.ts index 8654f1c..7a0174e 100644 --- a/src/ban/ban.service.ts +++ b/src/ban/ban.service.ts @@ -84,7 +84,7 @@ export class BanService { // Blocked by https://github.com/nestjsx/@nestjs/bull/pull/166 await this.processProfile(player, banStatusForUser); } else { - return this.logger.warn( + this.logger.warn( `Did not find banStatus for ${JSON.stringify(player)}` ); } @@ -260,7 +260,7 @@ export class BanService { const updatedPlayer = await this.playerService.updateLastCheckedAt(player); if (newBans.length) { - this.notificationService.sendNotification({ + await this.notificationService.sendNotification({ player: updatedPlayer, newBans, deletedBans diff --git a/src/match/demo.spec.ts b/src/match/demo.spec.ts index 547d99a..d0c4149 100644 --- a/src/match/demo.spec.ts +++ b/src/match/demo.spec.ts @@ -1,12 +1,11 @@ -import { entities, Position, Team } from '@bantr/lib/dist/entities'; +import { Position, Team } from '@bantr/lib/dist/entities'; import { IMatchType } from '@bantr/lib/dist/types'; import { RoundType } from '@bantr/lib/dist/types/RoundType.enum'; -import { Test, TestingModule } from '@nestjs/testing'; -import { TypeOrmModule } from '@nestjs/typeorm'; import * as dotenv from 'dotenv'; import * as fs from 'fs'; import * as path from 'path'; +import getDb from '../../test/getDb'; import Demo from './demo'; import Match from './match.entity'; @@ -31,31 +30,13 @@ describe('Demo handler', () => { let demoClass: Demo; - let app: TestingModule; let resultMatch: Match; beforeAll(done => { demoClass = new Demo(demoFileBuffer); - Test.createTestingModule({ - imports: [ - TypeOrmModule.forRoot({ - type: 'postgres', - host: process.env.BANTR_PG_HOST, - port: parseInt(process.env.BANTR_PG_PORT, 10), - username: process.env.BANTR_PG_USER, - password: process.env.BANTR_PG_PW, - database: process.env.BANTR_PG_DB, - entities: entities, - //dropSchema: process.env.CI === 'true' ? true : false, - dropSchema: true, - synchronize: true - }) - ] - }) - .compile() - .then(newApp => { - app = newApp; + getDb() + .then(() => { const initMatch = new Match(); initMatch.externalId = 'Testing Demo 5v5 faceit'; demoClass @@ -239,6 +220,5 @@ describe('Demo handler', () => { afterAll(async () => { await resultMatch.remove(); - await app.close(); }); });