forked from s7techlab/cckit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrouter_test.go
49 lines (35 loc) · 893 Bytes
/
router_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
48
49
package router_test
import (
"testing"
"github.com/hyperledger/fabric/core/chaincode/shim"
"github.com/hyperledger/fabric/protos/peer"
testcc "github.com/s7techlab/cckit/testing"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/s7techlab/cckit/router"
)
func TestRouter(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Router suite")
}
func New() *router.Chaincode {
r := router.New(`router`).
Init(router.EmptyContextHandler).
Invoke(`empty`, func(c router.Context) (interface{}, error) {
return nil, nil
})
return router.NewChaincode(r)
}
var cc *testcc.MockStub
var _ = Describe(`Router`, func() {
BeforeSuite(func() {
cc = testcc.NewMockStub(`Router`, New())
})
It(`Allow empty response`, func() {
Expect(cc.Invoke(`empty`)).To(BeEquivalentTo(peer.Response{
Status: shim.OK,
Payload: nil,
Message: ``,
}))
})
})