Global

Methods

_getStats(key)

Get the stats for a player
Parameters:
Name Type Description
key string
Source:

afterAll(functionopt, timeoutopt)

Run some shared teardown once after all of the specs in the describe are run. _Note:_ Be careful, sharing the teardown from a afterAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail.
Parameters:
Name Type Attributes Default Description
function implementationCallback <optional>
Function that contains the code to teardown your specs.
timeout Int <optional>
jasmine.DEFAULT_TIMEOUT_INTERVAL Custom timeout for an async afterAll.
Source:
See:
  • async

afterEach(functionopt, timeoutopt)

Run some shared teardown after each of the specs in the describe in which it is called.
Parameters:
Name Type Attributes Default Description
function implementationCallback <optional>
Function that contains the code to teardown your specs.
timeout Int <optional>
jasmine.DEFAULT_TIMEOUT_INTERVAL Custom timeout for an async afterEach.
Source:
See:
  • async

becomeSpectator()

Hide up down arrow keys
Source:

beforeAll(functionopt, timeoutopt)

Run some shared setup once before all of the specs in the describe are run. _Note:_ Be careful, sharing the setup from a beforeAll makes it easy to accidentally leak state between your specs so that they erroneously pass or fail.
Parameters:
Name Type Attributes Default Description
function implementationCallback <optional>
Function that contains the code to setup your specs.
timeout Int <optional>
jasmine.DEFAULT_TIMEOUT_INTERVAL Custom timeout for an async beforeAll.
Source:
See:
  • async

beforeEach(functionopt, timeoutopt)

Run some shared setup before each of the specs in the describe in which it is called.
Parameters:
Name Type Attributes Default Description
function implementationCallback <optional>
Function that contains the code to setup your specs.
timeout Int <optional>
jasmine.DEFAULT_TIMEOUT_INTERVAL Custom timeout for an async beforeEach.
Source:
See:
  • async

bind(down, up)

Bind an event listener for virtual key presses
Parameters:
Name Type Description
down The keydown event listener
up The keyup event listener
Source:

callbackify(fn)

Convert a function that returns a promise into a function that calls a callback
Parameters:
Name Type Description
fn
Source:

checkNameLength(playerName)

Checks the player's name length.
Parameters:
Name Type Description
playerName string the name of player you want to check
Source:

describe(description, specDefinitions)

Create a group of specs (often called a suite). Calls to `describe` can be nested within other calls to compose your suite as a tree.
Parameters:
Name Type Description
description String Textual description of the group
specDefinitions function Function for Jasmine to invoke that will define inner suites and specs
Source:

(async) destroy(sid)

Destroy a session
Parameters:
Name Type Description
sid The session id
Source:

disconnectPlayer(username)

Updates the player list to show a player disconnected.
Parameters:
Name Type Description
username string
Source:

dispatchGame(gameId)

Tell one of the game servers to start a game
Parameters:
Name Type Description
gameId The id of the game to start
Source:

draw()

Creates the elements of the disconnect message in PIXI.
Source:

drawPlayerInfo(id, player)

Draws the player's information to the player list.
Parameters:
Name Type Description
id int the index of the player
player string the player being drawn
Source:

expect(actual) → {matchers}

Create an expectation for a spec.
Parameters:
Name Type Description
actual Object Actual computed value to test expectations against.
Source:
Returns:
Type
matchers

expectAsync(actual) → {async-matchers}

Create an asynchronous expectation for a spec. Note that the matchers that are provided by an asynchronous expectation all return promises which must be either returned from the spec or waited for using `await` in order for Jasmine to associate them with the correct spec.
Parameters:
Name Type Description
actual Object Actual computed value to test expectations against.
Source:
Returns:
Type
async-matchers
Examples
await expectAsync(somePromise).toBeResolved();
return expectAsync(somePromise).toBeResolved();

fail(erroropt)

Explicitly mark a spec as failed.
Parameters:
Name Type Attributes Description
error String | Error <optional>
Reason for the failure.
Source:

fdescribe(description, specDefinitions)

A focused `describe` If suites or specs are focused, only those that are focused will be executed
Parameters:
Name Type Description
description String Textual description of the group
specDefinitions function Function for Jasmine to invoke that will define inner suites and specs
Source:
See:

fit(description, testFunction, timeoutopt)

A focused `it` If suites or specs are focused, only those that are focused will be executed.
Parameters:
Name Type Attributes Default Description
description String Textual description of what this spec is checking.
testFunction implementationCallback Function that contains the code of your test.
timeout Int <optional>
jasmine.DEFAULT_TIMEOUT_INTERVAL Custom timeout for an async spec.
Source:
See:
  • async

(async) get(sid)

Get a session from the db
Parameters:
Name Type Description
sid The session id
Source:

getAddr()

Get the game server address for a game
Source:

initHost()

Start the intercom server on the host
Source:

isAuthenticated(req, res, next)

Checks to make sure the user is authenticated.
Parameters:
Name Type Description
req
res
next
Source:

it(description, testFunctionopt, timeoutopt)

Define a single spec. A spec should contain one or more expectations that test the state of the code. A spec whose expectations all succeed will be passing and a spec with any failures will fail.
Parameters:
Name Type Attributes Default Description
description String Textual description of what this spec is checking
testFunction implementationCallback <optional>
Function that contains the code of your test. If not provided the test will be `pending`.
timeout Int <optional>
jasmine.DEFAULT_TIMEOUT_INTERVAL Custom timeout for an async spec.
Source:
See:
  • async

pending(messageopt)

Mark a spec as pending, expectation results will be ignored.
Parameters:
Name Type Attributes Description
message String <optional>
Reason the spec is pending.
Source:

removePlayer(username)

Removes the player from the list
Parameters:
Name Type Description
username string
Source:

render()

Renders the player list.
Source:

render()

Renders the disconnect message.
Source:

resize()

Resizes the disconnect box when the window is resized.
Source:

(async) set(sid, session)

Store a session in the db
Parameters:
Name Type Description
sid The session id
session The session data
Source:

spyOn(obj, methodName) → {Spy}

Install a spy onto an existing object.
Parameters:
Name Type Description
obj Object The object upon which to install the Spy.
methodName String The name of the method to replace with a Spy.
Source:
Returns:
Type
Spy

spyOnProperty(obj, propertyName, accessTypeopt) → {Spy}

Install a spy on a property installed with `Object.defineProperty` onto an existing object.
Parameters:
Name Type Attributes Default Description
obj Object The object upon which to install the Spy
propertyName String The name of the property to replace with a Spy.
accessType String <optional>
get The access type (get|set) of the property to Spy on.
Source:
Returns:
Type
Spy

spyOnProperty(obj) → {Object}

Installs spies on all writable and configurable properties of an object.
Parameters:
Name Type Description
obj Object The object upon which to install the Spys
Source:
Returns:
the spied object
Type
Object

update()

Update the position of the controls
Source:

update()

Updates the player list for each player.
Source:

xdescribe(description, specDefinitions)

A temporarily disabled `describe` Specs within an `xdescribe` will be marked pending and not executed
Parameters:
Name Type Description
description String Textual description of the group
specDefinitions function Function for Jasmine to invoke that will define inner suites and specs
Source:

xit(description, testFunctionopt)

A temporarily disabled `it` The spec will report as `pending` and will not be executed.
Parameters:
Name Type Attributes Description
description String Textual description of what this spec is checking.
testFunction implementationCallback <optional>
Function that contains the code of your test. Will not be executed.
Source:

Type Definitions

Expectation

Properties:
Name Type Description
matcherName String The name of the matcher that was executed for this expectation.
message String The failure message for the expectation.
stack String The stack trace for the failure if available.
passed Boolean Whether the expectation passed or failed.
expected Object If the expectation failed, what was the expected value.
actual Object If the expectation failed, what actual value was produced.
Source:

implementationCallback(doneopt)

Callback passed to parts of the Jasmine base interface. By default Jasmine assumes this function completes synchronously. If you have code that you need to test asynchronously, you can declare that you receive a `done` callback, return a Promise, or use the `async` keyword if it is supported in your environment.
Parameters:
Name Type Attributes Description
done function <optional>
Used to specify to Jasmine that this callback is asynchronous and Jasmine should wait until it has been called before moving on.
Source:
Returns:
Optionally return a Promise instead of using `done` to cause Jasmine to wait for completion.

JasmineDoneInfo

Information passed to the Reporter#jasmineDone event.
Properties:
Name Type Description
overallStatus OverallStatus The overall result of the sute: 'passed', 'failed', or 'incomplete'.
incompleteReason IncompleteReason Explanation of why the suite was incomplete.
order Order Information about the ordering (random or not) of this execution of the suite.
failedExpectations Array.<Expectation> List of expectations that failed in an afterAll at the global level.
deprecationWarnings Array.<Expectation> List of deprecation warnings that occurred at the global level.
Source:

JasmineStartedInfo

Information passed to the Reporter#jasmineStarted event.
Properties:
Name Type Description
totalSpecsDefined Int The total number of specs defined in this suite.
order Order Information about the ordering (random or not) of this execution of the suite.
Source:

SpecResult

Properties:
Name Type Description
id Int The unique id of this spec.
description String The description passed to the it that created this spec.
fullName String The full description including all ancestors of this spec.
failedExpectations Array.<Expectation> The list of expectations that failed during execution of this spec.
passedExpectations Array.<Expectation> The list of expectations that passed during execution of this spec.
deprecationWarnings Array.<Expectation> The list of deprecation warnings that occurred during execution this spec.
pendingReason String If the spec is pending, this will be the reason.
status String Once the spec has completed, this string represents the pass/fail status of this spec.
Source:

SuiteResult

Properties:
Name Type Description
id Int The unique id of this suite.
description String The description text passed to the describe that made this suite.
fullName String The full description including all ancestors of this suite.
failedExpectations Array.<Expectation> The list of expectations that failed in an afterAll for this suite.
deprecationWarnings Array.<Expectation> The list of deprecation warnings that occurred on this suite.
status String Once the suite has completed, this string represents the pass/fail status of this suite.
Source: