Skip to content

Commit

Permalink
Add config test factories
Browse files Browse the repository at this point in the history
Signed-off-by: Enrique Lacal <[email protected]>
  • Loading branch information
EnriqueL8 committed Sep 17, 2024
1 parent 1166747 commit 9bb9945
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 2 deletions.
24 changes: 23 additions & 1 deletion internal/blockchain/bifactory/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"testing"

"github.com/hyperledger/firefly-common/pkg/config"
"github.com/stretchr/testify/assert"
)

Expand All @@ -30,9 +31,30 @@ func TestGetPluginUnknown(t *testing.T) {
assert.Regexp(t, "FF10110", err)
}

func TestGetPlugin(t *testing.T) {
func TestGetPluginEthereum(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "ethereum")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

func TestGetPluginFabric(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "fabric")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

func TestGetPluginTezos(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "tezos")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

var root = config.RootSection("di")

func TestInitConfig(t *testing.T) {
conf := root.SubArray("plugins")
InitConfig(conf)
}
8 changes: 8 additions & 0 deletions internal/database/difactory/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"testing"

"github.com/hyperledger/firefly-common/pkg/config"
"github.com/stretchr/testify/assert"
)

Expand All @@ -36,3 +37,10 @@ func TestGetPlugin(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

var root = config.RootSection("di")

func TestInitConfig(t *testing.T) {
conf := root.SubArray("plugins")
InitConfig(conf)
}
8 changes: 8 additions & 0 deletions internal/dataexchange/dxfactory/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"testing"

"github.com/hyperledger/firefly-common/pkg/config"
"github.com/stretchr/testify/assert"
)

Expand All @@ -36,3 +37,10 @@ func TestGetPlugin(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

var root = config.RootSection("di")

func TestInitConfig(t *testing.T) {
conf := root.SubArray("plugins")
InitConfig(conf)
}
23 changes: 22 additions & 1 deletion internal/events/eifactory/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"testing"

"github.com/hyperledger/firefly-common/pkg/config"
"github.com/stretchr/testify/assert"
)

Expand All @@ -30,9 +31,29 @@ func TestGetPluginUnknown(t *testing.T) {
assert.Regexp(t, "FF10172", err)
}

func TestGetPlugin(t *testing.T) {
func TestGetPluginWebSockets(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "websockets")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

func TestGetPluginWebHooks(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "webhooks")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

func TestGetPluginEvents(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "system")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

var root = config.RootSection("di")

func TestInitConfig(t *testing.T) {
InitConfig(root)
}
8 changes: 8 additions & 0 deletions internal/identity/iifactory/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"testing"

"github.com/hyperledger/firefly-common/pkg/config"
"github.com/stretchr/testify/assert"
)

Expand All @@ -36,3 +37,10 @@ func TestGetPlugin(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

var root = config.RootSection("di")

func TestInitConfig(t *testing.T) {
conf := root.SubArray("plugins")
InitConfig(conf)
}
8 changes: 8 additions & 0 deletions internal/tokens/tifactory/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"testing"

"github.com/hyperledger/firefly-common/pkg/config"
"github.com/stretchr/testify/assert"
)

Expand All @@ -36,3 +37,10 @@ func TestGetPlugin(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, plugin)
}

var root = config.RootSection("tokens")

func TestInitConfig(t *testing.T) {
conf := root.SubArray("plugins")
InitConfig(conf)
}

0 comments on commit 9bb9945

Please sign in to comment.