diff --git a/api/controllers/pokemon_test.go b/api/controllers/pokemon_test.go index 307651e..bc0dddb 100644 --- a/api/controllers/pokemon_test.go +++ b/api/controllers/pokemon_test.go @@ -26,7 +26,7 @@ func (s *PokmemonTestSuite) SetupTest() { initJobs := os.Getenv("INIT_JOBS") if initJobs == "true" { - jobs.RefreshDB{DB: models.DB}.Run() + jobs.RefreshDB{DB: models.DB, Test: true}.Run() } } diff --git a/api/controllers/type_test.go b/api/controllers/type_test.go index 27a509f..bde2a05 100644 --- a/api/controllers/type_test.go +++ b/api/controllers/type_test.go @@ -25,7 +25,7 @@ func (s *TypeTestSuite) SetupTest() { initJobs := os.Getenv("INIT_JOBS") if initJobs == "true" { - jobs.RefreshDB{DB: models.DB}.Run() + jobs.RefreshDB{DB: models.DB, Test: true}.Run() } } diff --git a/api/jobs/refresh-db.go b/api/jobs/refresh-db.go index 3251cad..0ffedbb 100644 --- a/api/jobs/refresh-db.go +++ b/api/jobs/refresh-db.go @@ -12,7 +12,8 @@ import ( ) type RefreshDB struct { - DB *gorm.DB + DB *gorm.DB + Test bool } type DamageLink struct { @@ -113,7 +114,16 @@ func (r RefreshDB) refreshTypes() { } func (r RefreshDB) refreshPokemon() { - pokemonResource, err := pokeapi.Resource("pokemon-species", 0, 1500) + + var count int + + if r.Test { + count = 50 + } else { + count = 1500 + } + + pokemonResource, err := pokeapi.Resource("pokemon-species", 0, count) if err != nil { log.Printf("Failed to get pokemon: %s", err)