Improved Article model

This commit is contained in:
Florian Sylvain
2023-01-09 09:53:33 +01:00
parent 117df6914b
commit 8be0059525
4 changed files with 25 additions and 21 deletions
+6 -6
View File
@@ -9,18 +9,18 @@ import (
)
var Article1, _ = bson.Marshal(Article{
IdName: "test_article_1",
TitleID: "test_article_1",
Date: 1671482492,
Content: gin.H{},
PageID: "blog",
Tags: []string{"blog"},
Online: false,
})
var Article2, _ = bson.Marshal(Article{
IdName: "test_article_2",
TitleID: "test_article_2",
Date: 1671899112,
Content: gin.H{},
PageID: "blog",
Tags: []string{"blog"},
Online: false,
})
@@ -30,8 +30,8 @@ func TestGetAllArticlesBusiness(t *testing.T) {
documents := GetAllArticlesBusiness(BSONConvertedArticles)
article := documents[0]
if article.IdName != "test_article_1" {
log.Fatalf(`Excepted "test_article_1" as IdName, found "%v"`, article.IdName)
if article.TitleID != "test_article_1" {
log.Fatalf(`Excepted "test_article_1" as IdName, found "%v"`, article.TitleID)
} else if article.Date != 1671482492 {
log.Fatalf(`Excepted 1671482492 as Date, found "%v"`, article.Date)
}