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:
Danny 2022-06-10 10:41:45 -04:00 committed by GitHub
parent 8a450c07b5
commit f713047f95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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)
}