😎 More tests!
This commit is contained in:
parent
e17cb8b467
commit
ae5a43be2d
2
page.go
2
page.go
|
@ -167,7 +167,7 @@ func GetViews(path string, year int, month int, day int, hour int) (*PageViews,
|
||||||
// will be returned.
|
// will be returned.
|
||||||
args.Add("month", strconv.Itoa(month))
|
args.Add("month", strconv.Itoa(month))
|
||||||
|
|
||||||
if year >= 2000 && year <= 2100 {
|
if year > 0 {
|
||||||
// Required if month is passed. If passed, the number of page views for the requested year
|
// Required if month is passed. If passed, the number of page views for the requested year
|
||||||
// will be returned.
|
// will be returned.
|
||||||
args.Add("year", strconv.Itoa(year))
|
args.Add("year", strconv.Itoa(year))
|
||||||
|
|
|
@ -67,6 +67,7 @@ func TestCreateValidPage(t *testing.T) {
|
||||||
newPage := &Page{
|
newPage := &Page{
|
||||||
Title: "Sample Page",
|
Title: "Sample Page",
|
||||||
AuthorName: "Anonymous",
|
AuthorName: "Anonymous",
|
||||||
|
AuthorURL: "https://telegram.me/telegraph",
|
||||||
Content: content,
|
Content: content,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +215,7 @@ func TestGetInvalidViewsByMonth(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGetInvalidViewsByYear(t *testing.T) {
|
func TestGetInvalidViewsByYear(t *testing.T) {
|
||||||
_, err := GetViews("Sample-Page-12-15", 1984, 12, 24, 23)
|
_, err := GetViews("Sample-Page-12-15", 2100, 12, 24, 23)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err.Error())
|
t.Error(err.Error())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue