Skip to content

Commit

Permalink
more factories test
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 447a010 commit 1166747
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
38 changes: 38 additions & 0 deletions internal/database/difactory/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 difactory

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, "FF10122", err)
}

func TestGetPlugin(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "postgres")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}
38 changes: 38 additions & 0 deletions internal/events/eifactory/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 eifactory

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, "FF10172", err)
}

func TestGetPlugin(t *testing.T) {
ctx := context.Background()
plugin, err := GetPlugin(ctx, "websockets")
assert.NoError(t, err)
assert.NotNil(t, plugin)
}
38 changes: 38 additions & 0 deletions internal/tokens/tifactory/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 tifactory

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, "FF10272", err)
}

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

0 comments on commit 1166747

Please sign in to comment.