Additional unit tests.

This commit is contained in:
go-jet 2019-07-20 11:22:01 +02:00
parent e431f3ecb1
commit e74e090b0a
4 changed files with 144 additions and 1 deletions

View file

@ -109,6 +109,28 @@ INSERT INTO test_sample.link (url, name) VALUES
assertExec(t, query, 1)
}
func TestInsertModelObjectEmptyColumnList(t *testing.T) {
cleanUpLinkTable(t)
var expectedSQL = `
INSERT INTO test_sample.link VALUES
(1000, 'http://www.duckduckgo.com', 'Duck Duck go', NULL);
`
linkData := model.Link{
ID: 1000,
URL: "http://www.duckduckgo.com",
Name: "Duck Duck go",
}
query := Link.
INSERT().
MODEL(linkData)
assertStatementSql(t, query, expectedSQL, int32(1000), "http://www.duckduckgo.com", "Duck Duck go", nil)
assertExec(t, query, 1)
}
func TestInsertModelsObject(t *testing.T) {
expectedSQL := `
INSERT INTO test_sample.link (url, name) VALUES