Skip to content

Commit

Permalink
more test for 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 0a026e4 commit 447a010
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
38 changes: 38 additions & 0 deletions internal/blockchain/bifactory/factory_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package bifactory

import (
"context"
"testing"

"github.com/stretchr/testify/assert"
)

func TestGetPluginUnknown(t *testing.T) {
ctx := context.Background()
_, err := GetPlugin(ctx, "foo")
assert.Error(t, err)
assert.Regexp(t, "FF10110", err)
}

func TestGetPlugin(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "ethereum")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}
38 changes: 38 additions & 0 deletions internal/dataexchange/dxfactory/factory_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package dxfactory

import (
"context"
"testing"

"github.com/stretchr/testify/assert"
)

func TestGetPluginUnknown(t *testing.T) {
ctx := context.Background()
_, err := GetPlugin(ctx, "foo")
assert.Error(t, err)
assert.Regexp(t, "FF10213", err)
}

func TestGetPlugin(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "ffdx")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}
38 changes: 38 additions & 0 deletions internal/identity/iifactory/factory_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package iifactory

import (
"context"
"testing"

"github.com/stretchr/testify/assert"
)

func TestGetPluginUnknown(t *testing.T) {
ctx := context.Background()
_, err := GetPlugin(ctx, "foo")
assert.Error(t, err)
assert.Regexp(t, "FF10212", err)
}

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

0 comments on commit 447a010

Please sign in to comment.