😎 More tests!

This commit is contained in:
Maxim Lebedev 2016-12-24 23:22:31 +05:00
parent e17cb8b467
commit ae5a43be2d
No known key found for this signature in database
GPG Key ID: F8978F46FF0FFA4F
2 changed files with 3 additions and 2 deletions

View File

@ -167,7 +167,7 @@ func GetViews(path string, year int, month int, day int, hour int) (*PageViews,
// will be returned.
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
// will be returned.
args.Add("year", strconv.Itoa(year))

View File

@ -67,6 +67,7 @@ func TestCreateValidPage(t *testing.T) {
newPage := &Page{
Title: "Sample Page",
AuthorName: "Anonymous",
AuthorURL: "https://telegram.me/telegraph",
Content: content,
}
@ -214,7 +215,7 @@ func TestGetInvalidViewsByMonth(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 {
t.Error(err.Error())
}