Merge NewClient and JoinWorkspace into Connect

This commit is contained in:
Alan Donovan 2021-09-21 12:44:30 -04:00
parent 7765628033
commit b3b675d108
4 changed files with 61 additions and 101 deletions

View file

@ -32,14 +32,9 @@ func makeMockSession(opts ...livesharetest.ServerOption) (*livesharetest.Server,
)
connection.RelayEndpoint = "sb" + strings.TrimPrefix(testServer.URL(), "https")
tlsConfig := WithTLSConfig(&tls.Config{InsecureSkipVerify: true})
client, err := NewClient(WithConnection(connection), tlsConfig)
session, err := Connect(context.Background(), WithConnection(connection), tlsConfig)
if err != nil {
return nil, nil, fmt.Errorf("error creating new client: %v", err)
}
ctx := context.Background()
session, err := client.JoinWorkspace(ctx)
if err != nil {
return nil, nil, fmt.Errorf("error joining workspace: %v", err)
return nil, nil, fmt.Errorf("error connecting to Live Share: %v", err)
}
return testServer, session, nil
}