(t *testing.T)
| 213 | } |
| 214 | |
| 215 | func TestYJSBidirectionalRelay(t *testing.T) { |
| 216 | ensureServer() |
| 217 | token := signUpAndGetToken(t) |
| 218 | |
| 219 | docName := fmt.Sprintf("bidir-%d", time.Now().UnixNano()) |
| 220 | |
| 221 | connA := connectAndSubscribe(t, docName, token) |
| 222 | defer connA.Close() |
| 223 | connB := connectAndSubscribe(t, docName, token) |
| 224 | defer connB.Close() |
| 225 | |
| 226 | // A → B |
| 227 | connA.WriteMessage(gorillaWs.BinaryMessage, buildYjsUpdate([]byte{0x01})) |
| 228 | _, okAB := tryReadYJSMessage(connB, 5*time.Second) |
| 229 | if !okAB { |
| 230 | t.Error("A→B relay failed") |
| 231 | } |
| 232 | |
| 233 | // B → A |
| 234 | connB.WriteMessage(gorillaWs.BinaryMessage, buildYjsUpdate([]byte{0x02})) |
| 235 | _, okBA := tryReadYJSMessage(connA, 5*time.Second) |
| 236 | if !okBA { |
| 237 | t.Error("B→A relay failed") |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | func TestYJSSyncStep1Forwarding(t *testing.T) { |
| 242 | ensureServer() |
nothing calls this directly
no test coverage detected