forked from TcM1911/clinote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient_test.go
47 lines (41 loc) · 1.5 KB
/
client_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
42
43
44
45
46
47
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*
* Copyright (C) Joakim Kennedy, 2018
*/
package clinote
import (
"reflect"
"testing"
"github.com/stretchr/testify/assert"
)
func TestClient(t *testing.T) {
assert := assert.New(t)
store := new(mockStore)
cfg := new(DefaultConfig)
ns := new(mockNS)
t.Run("default client", func(t *testing.T) {
c := NewClient(cfg, store, ns, DefaultClientOptions)
assert.NotNil(c, "None nil client")
expectedFunc := reflect.ValueOf(newFileCacheFile).Pointer()
actualFunc := reflect.ValueOf(c.newCacheFile).Pointer()
assert.Equal(expectedFunc, actualFunc, "Wrong cache creating function")
assert.IsType(new(EnvEditor), c.Editor, "Wrong default editor")
})
t.Run("client using Vim", func(t *testing.T) {
c := NewClient(cfg, store, ns, DefaultClientOptions|VimEditer)
assert.NotNil(c, "None nil client")
assert.IsType(new(VimEditor), c.Editor, "Wrong editer type")
})
}