 
 
 
-  describe "MATCHING (players with instances of games)", () ->
+  describe "MATCHING (players with games)", () ->
+
+    InBetween = Date.now()
 
     it "should allow any logged in player to host games", (done) ->
       @anyplayer.emit 'host', { game: "my.game", min: 2, max: 3}

      @anyplayer.on 'join', (msg) =>
        expect(msg.player).to.equal "Ananda"
        expect(msg.id).to.equal MatchId
        done()

  
  


  describe "HISTORY (catch up)", ->

    it "should tell (the diff) what happened in some meanwhile", (done) ->
      @anyplayer.emit 'history', { since: Date.now }
      @anyplayer.on 'history', (diffs) ->
        expect(diffs).to.deep.equal( {
          players: [],
          games: [],
          match: [],
          chat: []
          stats: { player_online: 3, games_played: 1}
        } # not much happened since now :-)
    
      @anyplayer.emit 'history', { since: BeginOfTest }
      @anyplayer.on 'history', (diffs) ->
        expect(diffs).to.deep.equal( {
          players: [],
          games: [],
          match: [ {
            id: MatchID
            min: 2
            max: 3
            host: "Anyname"
            players: ["Ananda"]
            } ],
          chat: ["Lukas:   happy again :-)"]
          stats: { player_online: 3, games_played: 1}
        }
 
 



  describe "CUSTOM MESSAGING", () ->

    it "should send custom game messages to everyone in the game", (done) ->
      @anyplayer.emit 'move', {foo: "my", data: 42}
      @anotherplayer.on 'move', (msg) =>
        expect(msg).to.deep.equal( {
          foo: "my"
          data: 42
        }






server = require '../server'
expect = require('chai').expect
io = require 'socket.io-client'
BeginOfTest = 0
InBetween = 0
MatchId = ""
History = 0

#   GCP PROTOCOL SPECIFICATION   *StudioLounge Multiplayer Game*
#                         v0.4                           (draft)
