-
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.
Added new and updated utils methods for constrains. Also, added integ…
…ration tests. Restructured some other parts.
- Loading branch information
Showing
5 changed files
with
94 additions
and
68 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,60 @@ | ||
package database | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func Test_Integration_Initialize(t *testing.T) { | ||
databaseService := NewDatabaseService() | ||
err := databaseService.Initialize() | ||
assert.NoError(t, err) | ||
|
||
isInitialized := databaseService.IsInitialized() | ||
assert.True(t, isInitialized) | ||
|
||
err = databaseService.Close() | ||
assert.NoError(t, err) | ||
} | ||
|
||
func Test_Integration_IsInitialized(t *testing.T) {} | ||
|
||
func Test_Integration_CreateTable(t *testing.T) { | ||
databaseService := NewDatabaseService() | ||
err := databaseService.Initialize() | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.CreateTable(Table{Name: "test"}) | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.Close() | ||
assert.NoError(t, err) | ||
} | ||
|
||
func Test_Integration_Insert(t *testing.T) { | ||
databaseService := NewDatabaseService() | ||
err := databaseService.Initialize() | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.Insert(Table{Name: "test"}, []string{"Joe", "Jack"}) | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.Close() | ||
assert.NoError(t, err) | ||
} | ||
|
||
func Test_Integration_Select(t *testing.T) {} | ||
|
||
func Test_Integration_Delete(t *testing.T) {} | ||
|
||
func Test_Integration_DropTable(t *testing.T) { | ||
databaseService := NewDatabaseService() | ||
err := databaseService.Initialize() | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.DropTable(Table{Name: "test"}) | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.Close() | ||
assert.NoError(t, err) | ||
} |
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 |
---|---|---|
@@ -1,64 +1,17 @@ | ||
package database | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestInitialize(t *testing.T) { | ||
databaseService := NewDatabaseService() | ||
err := databaseService.Initialize() | ||
assert.NoError(t, err) | ||
|
||
isInitialized := databaseService.IsInitialized() | ||
assert.True(t, isInitialized) | ||
|
||
err = databaseService.Close() | ||
assert.NoError(t, err) | ||
} | ||
|
||
func TestClose(t *testing.T) {} | ||
|
||
func TestIsInitialized(t *testing.T) {} | ||
|
||
func TestCreateTable(t *testing.T) { | ||
databaseService := NewDatabaseService() | ||
err := databaseService.Initialize() | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.CreateTable(Table{Name: "test"}) | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.Close() | ||
assert.NoError(t, err) | ||
} | ||
|
||
func TestInsert(t *testing.T) { | ||
databaseService := NewDatabaseService() | ||
err := databaseService.Initialize() | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.Insert(Table{Name: "test"}, []string{"Joe", "Jack"}) | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.Close() | ||
assert.NoError(t, err) | ||
} | ||
|
||
func TestDelete(t *testing.T) {} | ||
func TestInsert(t *testing.T) {} | ||
|
||
func TestUpdate(t *testing.T) {} | ||
|
||
func TestSelect(t *testing.T) {} | ||
|
||
func TestDropTable(t *testing.T) { | ||
databaseService := NewDatabaseService() | ||
err := databaseService.Initialize() | ||
assert.NoError(t, err) | ||
|
||
err = databaseService.DropTable(Table{Name: "test"}) | ||
assert.NoError(t, err) | ||
func TestDelete(t *testing.T) {} | ||
|
||
err = databaseService.Close() | ||
assert.NoError(t, err) | ||
} | ||
func TestDropTable(t *testing.T) {} |
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