-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(db-driver): unit test validateDbDriver
- Loading branch information
1 parent
008ef90
commit ff6ceac
Showing
3 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package gograte_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Shin-Thant/gograte" | ||
) | ||
|
||
func TestValidateDbDriver(t *testing.T) { | ||
// validate supported drivers | ||
inputDrivers := []string{"sqlite3", "postgres", "mysql"} | ||
for _, driver := range inputDrivers { | ||
result := gograte.ValidateDbDriver(driver) | ||
if !result { | ||
t.Errorf("Expected true but got false for driver: %s", driver) | ||
} | ||
} | ||
|
||
// validate unsupported drivers | ||
unsupportedDrivers := []string{"sqlite", "pgx", "mysqlx", "mssql"} | ||
for _, driver := range unsupportedDrivers { | ||
result := gograte.ValidateDbDriver(driver) | ||
if result { | ||
t.Errorf("Expected false but got true for driver: %s", driver) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters