-
Notifications
You must be signed in to change notification settings - Fork 123
/
session_test.go
41 lines (33 loc) · 1.01 KB
/
session_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package gitbase
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/connectivity"
)
func TestSessionBblfshClient(t *testing.T) {
require := require.New(t)
session := NewSession(nil, WithBblfshEndpoint(defaultBblfshEndpoint))
cli, err := session.BblfshClient()
require.NoError(err)
require.NotNil(cli)
require.Equal(connectivity.Ready, cli.GetState())
}
func TestSupportedLanguagesAliases(t *testing.T) {
require := require.New(t)
session := NewSession(nil, WithBblfshEndpoint(defaultBblfshEndpoint))
cli, err := session.BblfshClient()
require.NoError(err)
require.NotNil(cli)
require.Equal(connectivity.Ready, cli.GetState())
ok, err := cli.IsLanguageSupported(context.TODO(), "C++")
require.NoError(err)
require.True(ok)
}
func TestSessionBblfshClientNoConnection(t *testing.T) {
require := require.New(t)
session := NewSession(nil, WithBblfshEndpoint("localhost:9999"))
_, err := session.BblfshClient()
require.Error(err)
require.True(ErrBblfshConnection.Is(err))
}