diff --git a/internal/blockchain/bifactory/factory_test.go b/internal/blockchain/bifactory/factory_test.go new file mode 100644 index 000000000..927e36d50 --- /dev/null +++ b/internal/blockchain/bifactory/factory_test.go @@ -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) +} diff --git a/internal/dataexchange/dxfactory/factory_test.go b/internal/dataexchange/dxfactory/factory_test.go new file mode 100644 index 000000000..7fca265d2 --- /dev/null +++ b/internal/dataexchange/dxfactory/factory_test.go @@ -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) +} diff --git a/internal/identity/iifactory/factory_test.go b/internal/identity/iifactory/factory_test.go new file mode 100644 index 000000000..4f2cac10b --- /dev/null +++ b/internal/identity/iifactory/factory_test.go @@ -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) +}