Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmay-db committed Oct 9, 2024
1 parent 41e1c39 commit 00c5d2b
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions internal/providers/pluginfw/common/common_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package common

import (
"context"
"testing"

"github.com/databricks/databricks-sdk-go/useragent"
"github.com/stretchr/testify/assert"
)

func TestGetDatabricksStagingName(t *testing.T) {
resourceName := "test"
expected := "databricks_test_pluginframework"
result := GetDatabricksStagingName(resourceName)
assert.Equal(t, expected, result, "GetDatabricksStagingName should return the expected staging name")
}

func TestGetDatabricksProductionName(t *testing.T) {
resourceName := "test"
expected := "databricks_test"
result := GetDatabricksProductionName(resourceName)
assert.Equal(t, expected, result, "GetDatabricksProductionName should return the expected production name")
}

func TestSetResourceNameInContext(t *testing.T) {
ctx := context.Background()
resourceKey := "resource"
resourceName := "test-resource"
actualContext := SetResourceNameInContext(ctx, resourceName)
expectedContext := useragent.InContext(ctx, resourceKey, resourceName)
assert.Equal(t, expectedContext, actualContext)
}

func TestSetDataSourceNameInContext(t *testing.T) {
ctx := context.Background()
dataSourceKey := "data"
dataSourceName := "test-datasource"
actualContext := SetDataSourceNameInContext(ctx, dataSourceName)
expectedContext := useragent.InContext(ctx, dataSourceKey, dataSourceName)
assert.Equal(t, expectedContext, actualContext)
}

0 comments on commit 00c5d2b

Please sign in to comment.