73 lines
1.5 KiB
Go
73 lines
1.5 KiB
Go
package models
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestArticle_FromFile(t *testing.T) {
|
|
type fields struct {
|
|
Title string
|
|
HtmlContent string
|
|
publishedDate string
|
|
Url string
|
|
File string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
want Article
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
a := Article{
|
|
Title: tt.fields.Title,
|
|
HtmlContent: tt.fields.HtmlContent,
|
|
publishedDate: tt.fields.publishedDate,
|
|
Url: tt.fields.Url,
|
|
File: tt.fields.File,
|
|
}
|
|
if got := a.FromFile(); !reflect.DeepEqual(got, tt.want) {
|
|
t.Errorf("Article.FromFile() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestArticle_FromContent(t *testing.T) {
|
|
type fields struct {
|
|
Title string
|
|
HtmlContent string
|
|
publishedDate string
|
|
Url string
|
|
File string
|
|
}
|
|
type args struct {
|
|
content []byte
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
fields fields
|
|
args args
|
|
want Article
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
a := Article{
|
|
Title: tt.fields.Title,
|
|
HtmlContent: tt.fields.HtmlContent,
|
|
publishedDate: tt.fields.publishedDate,
|
|
Url: tt.fields.Url,
|
|
File: tt.fields.File,
|
|
}
|
|
if got := a.FromContent(tt.args.content); !reflect.DeepEqual(got, tt.want) {
|
|
t.Errorf("Article.FromContent() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|