Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Commit

Permalink
feat(webSocket): tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sha49 committed Apr 1, 2016
1 parent d19c63e commit d697af8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/blockchain_socket.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ describe "Websocket", ->
# ws.socket is not defined, so nothing to spy on
expect(() -> ws.send(message)).not.toThrow()

describe "close()", ->
beforeEach ->
ws.connect()

it "should clear interval and timeout", ->
ws.close()
expect(ws.pingTimeoutPID).toEqual(null)
expect(ws.socket).toEqual(null)

describe "ping()", ->
beforeEach ->
ws.connect()

it "should clear interval and timeout", ->
spyOn(ws, "send")
ws.ping()
expected = JSON.stringify({op: "ping"})
expect(ws.send).toHaveBeenCalledWith(expected)

describe "msgWalletSub()", ->
it "should subscribe to a guid", ->
res = ws.msgWalletSub("1234")
Expand Down

0 comments on commit d697af8

Please sign in to comment.