Testing expansion (#177)
Incremental tests added to project Functional test added to test package to showcase usage and streamline on GraphConnector test suite.
This commit is contained in:
parent
8a450c07b5
commit
f713047f95
45
src/internal/testing/envvars_test.go
Normal file
45
src/internal/testing/envvars_test.go
Normal file
@ -0,0 +1,45 @@
|
||||
package testing
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type EnvvarsTestSuite struct {
|
||||
suite.Suite
|
||||
}
|
||||
|
||||
func TestEnvvarsSuite(t *testing.T) {
|
||||
suite.Run(t, new(EnvvarsTestSuite))
|
||||
}
|
||||
|
||||
func (suite EnvvarsTestSuite) TestRunOnAny() {
|
||||
env_variable := "TEST_ENVVARS_SUITE"
|
||||
os.Setenv(env_variable, "1")
|
||||
table := []struct {
|
||||
name string
|
||||
param string
|
||||
function assert.ErrorAssertionFunc
|
||||
}{
|
||||
{
|
||||
name: "Valid Environment",
|
||||
param: env_variable,
|
||||
function: assert.NoError,
|
||||
},
|
||||
{
|
||||
name: "Invalid Environment",
|
||||
param: "TEST_ENVVARS_SUITE_INVALID",
|
||||
function: assert.Error,
|
||||
},
|
||||
}
|
||||
for _, test := range table {
|
||||
suite.T().Run(test.name, func(t *testing.T) {
|
||||
result := RunOnAny(test.param)
|
||||
test.function(suite.T(), result)
|
||||
})
|
||||
}
|
||||
os.Unsetenv(env_variable)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user