Skip to content

Commit

Permalink
test: fix PlayerBansService test (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrappachc authored Feb 19, 2020
1 parent bb5d971 commit a47359f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/players/services/player-bans.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import { Test, TestingModule } from '@nestjs/testing';
import { PlayerBansService } from './player-bans.service';
import { getModelToken, TypegooseModule } from 'nestjs-typegoose';
import { PlayerBan } from '../models/player-ban';
import { Types } from 'mongoose';
import { OnlinePlayersService } from './online-players.service';
import { DiscordNotificationsService } from '@/discord/services/discord-notifications.service';
import { ObjectId } from 'mongodb';
import { typegooseTestingModule } from '@/utils/testing-typegoose-module';
import { ReturnModelType, DocumentType } from '@typegoose/typegoose';
import { MongoMemoryServer } from 'mongodb-memory-server';
import { floor } from 'lodash';

class OnlinePlayersServiceStub {
getSocketsForPlayer(playerId: string) { return []; }
Expand Down Expand Up @@ -155,7 +153,7 @@ describe('PlayerBansService', () => {

it('should revoke the ban', async () => {
const ban = await service.revokeBan(mockBan.id);
expect(floor(ban.end.getTime() / 1000)).toEqual(floor(new Date().getTime() / 1000));
expect(ban.end.getTime()).toBeLessThanOrEqual(new Date().getTime());
});

it('should emit the event', async done => {
Expand Down

0 comments on commit a47359f

Please sign in to comment.