2019-06-03 09:32:43 +00:00
|
|
|
package arn_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-08-25 06:41:59 +00:00
|
|
|
"github.com/akyoto/assert"
|
2019-06-03 09:32:43 +00:00
|
|
|
"github.com/animenotifier/notify.moe/arn"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestNewAnime(t *testing.T) {
|
|
|
|
anime := arn.NewAnime()
|
|
|
|
assert.NotNil(t, anime)
|
2019-08-25 06:41:59 +00:00
|
|
|
assert.NotEqual(t, anime.ID, "")
|
|
|
|
assert.NotEqual(t, anime.Created, "")
|
2019-06-03 09:32:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestGetAnime(t *testing.T) {
|
|
|
|
// Existing anime
|
|
|
|
anime, err := arn.GetAnime("74y2cFiiR")
|
2019-08-25 06:41:59 +00:00
|
|
|
assert.Nil(t, err)
|
2019-06-03 09:32:43 +00:00
|
|
|
assert.NotNil(t, anime)
|
2019-08-25 06:41:59 +00:00
|
|
|
assert.NotEqual(t, anime.ID, "")
|
|
|
|
assert.NotEqual(t, anime.Title.Canonical, "")
|
2019-06-03 09:32:43 +00:00
|
|
|
|
|
|
|
// Not existing anime
|
|
|
|
anime, err = arn.GetAnime("does not exist")
|
2019-08-25 06:41:59 +00:00
|
|
|
assert.NotNil(t, err)
|
2019-06-03 09:32:43 +00:00
|
|
|
assert.Nil(t, anime)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAllAnime(t *testing.T) {
|
|
|
|
validAnimeStatus := []string{
|
|
|
|
"finished",
|
|
|
|
"current",
|
|
|
|
"upcoming",
|
|
|
|
"tba",
|
|
|
|
}
|
|
|
|
|
|
|
|
validAnimeType := []string{
|
|
|
|
"tv",
|
|
|
|
"movie",
|
|
|
|
"ova",
|
|
|
|
"ona",
|
|
|
|
"special",
|
|
|
|
"music",
|
|
|
|
}
|
|
|
|
|
|
|
|
allAnime := arn.AllAnime()
|
|
|
|
|
|
|
|
for _, anime := range allAnime {
|
|
|
|
|
2019-08-25 06:41:59 +00:00
|
|
|
assert.NotEqual(t, anime.ID, "")
|
|
|
|
assert.Contains(t, validAnimeStatus, anime.Status)
|
|
|
|
assert.Contains(t, validAnimeType, anime.Type)
|
|
|
|
assert.Contains(t, validAnimeStatus, anime.CalculatedStatus())
|
|
|
|
assert.NotEqual(t, anime.StatusHumanReadable(), "")
|
|
|
|
assert.NotEqual(t, anime.TypeHumanReadable(), "")
|
|
|
|
assert.NotEqual(t, anime.Link(), "")
|
|
|
|
assert.NotEqual(t, anime.EpisodeCountString(), "")
|
2019-06-03 09:32:43 +00:00
|
|
|
|
|
|
|
anime.Episodes()
|
|
|
|
anime.Characters()
|
|
|
|
anime.StartDateTime()
|
|
|
|
anime.EndDateTime()
|
|
|
|
anime.HasImage()
|
|
|
|
anime.GetMapping("shoboi/anime")
|
|
|
|
anime.Studios()
|
|
|
|
anime.Producers()
|
|
|
|
anime.Licensors()
|
|
|
|
anime.Prequels()
|
|
|
|
}
|
|
|
|
}
|