Skip to content

Commit

Permalink
Merge pull request #7 from Tarnadas/dev
Browse files Browse the repository at this point in the history
Travis CI
  • Loading branch information
Mario Reder authored Jul 3, 2018
2 parents 1b3d669 + b354fe1 commit 016305f
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"parser": "typescript-eslint-parser",
"extends": [
"standard-with-typescript"
"standard-with-typescript",
"plugin:jest/recommended"
],
"plugins": [
"typescript",
"jsdoc"
"jsdoc",
"jest"
],
"rules": {
"indent": "off",
Expand Down
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js
node_js:
- "8.9.4"
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
before_install:
- npm install -g yarn --cache-min 999999999
install:
- yarn
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"eslint-config-standard": "^11.0.0",
"eslint-config-standard-with-typescript": "^2.0.1",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jest": "^21.17.0",
"eslint-plugin-jsdoc": "^3.4.1",
"eslint-plugin-node": "^6.0.0",
"eslint-plugin-promise": "^3.6.0",
Expand Down
13 changes: 10 additions & 3 deletions src/Client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Client, CONNECTION_TIMEOUT, DECOMPRESSION_ERROR, AFK_TIMEOUT, AFK_TIMEO
import { IClientServerMessage, Compression, ClientServer, ClientServerMessage, Chat } from './proto/ClientServerMessage'
import { IServerClientMessage, ServerClient, ServerClientMessage, ServerMessage, Error as ErrorProto } from './proto/ServerClientMessage'
import {
MESSAGES_PER_HALF_MINUTE_THRESHOLD, MESSAGES_PER_HALF_MINUTE_DOS_THRESHOLD, MESSAGE_CHARACTERS_PER_HALF_MINUTE_THRESHOLD, SPAM_NOTIFICATION_MESSAGE, warningLevelMuteMapping
MESSAGES_PER_HALF_MINUTE_THRESHOLD, MESSAGES_PER_HALF_MINUTE_DOS_THRESHOLD, MESSAGE_CHARACTERS_PER_HALF_MINUTE_THRESHOLD, SPAM_NOTIFICATION_MESSAGE, warningLevelMuteMapping, Identity
} from './Identity'

const addClient = (client: Client) => {
Expand Down Expand Up @@ -35,7 +35,10 @@ describe('Client', () => {
fnMocks[type] = callback
},
send: jest.fn(),
close: jest.fn()
close: jest.fn(),
_socket: {
remoteAddress: '127.0.0.1'
}
}
client = new Client(1, wsMock)
addClient(client)
Expand All @@ -45,6 +48,10 @@ describe('Client', () => {
expect(webSocketServer.clients[client.id]).toBeDefined()
})

beforeEach(() => {
Identity.Identities = {}
})

it('should automatically disconnect, if no handshake and player data gets received in timeout interval', () => {
jest.advanceTimersByTime(CONNECTION_TIMEOUT)

Expand Down Expand Up @@ -249,7 +256,7 @@ describe('Client', () => {
data: {
messageType: ClientServer.MessageType.CHAT,
chat: {
chatType: Chat.ChatType.GLOBAL,
chatType: Chat.ChatType.COMMAND,
message: SPAM_NOTIFICATION_MESSAGE(warningLevelMuteMapping[warningLevel])
}
}
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2531,6 +2531,10 @@ eslint-plugin-import@~2.2.0:
minimatch "^3.0.3"
pkg-up "^1.0.0"

eslint-plugin-jest@^21.17.0:
version "21.17.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.17.0.tgz#fdb00e2f9ff16987d6ebcf2c75c7add105760bbb"

eslint-plugin-jsdoc@^3.4.1:
version "3.4.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-3.4.1.tgz#aea72244a71dcffa3524615f661478f01bbbd826"
Expand Down

0 comments on commit 016305f

Please sign in to comment.