titan-x / titan

Messaging server with mobile and browser support.
MIT License
2 stars 3 forks source link

Wrap all custom client methods (i.e. Client.Echo) etc. in ClientHelper and use them in tests #86

Closed soygul closed 8 years ago

soygul commented 8 years ago

Currently we're doing this:

    ch.Client.Echo(map[string]string{"message": msg}, func(m *client.Message) error {
        defer wg.Done()
        if m.Message != msg {
            t.Fatalf("expected: %v, got: %v", "wow", m.Message)
        }
        return nil
    })
  1. Manual wg.Done() should be done by ClientHelper
  2. Echo returns error type in the handler and on the outside, both of which should be checked by the ClientHelper
  3. Start with mst_test.TestSendEcho then move on to TestSendMsgOnline, TestValidToken, etc.