Skip to content

Commit

Permalink
updating factory test files, don't truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
r-mettler committed Oct 17, 2024
1 parent 08e2055 commit 2fcb030
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 271 deletions.
4 changes: 0 additions & 4 deletions pkg/factory/address_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ func BuildAddress(db *pop.Connection, customs []Customization, traits []Trait) m
IsOconus: models.BoolPointer(false),
}

var usprc = BuildUsPostRegionCity(db, customs, nil)
address.UsPostRegionCityId = &usprc.ID
address.UsPostRegionCity = &usprc

// Find/create the Country if customization is provided
var country models.Country
if result := findValidCustomization(customs, Country); result != nil {
Expand Down
84 changes: 0 additions & 84 deletions pkg/factory/re_cities_factory.go

This file was deleted.

81 changes: 0 additions & 81 deletions pkg/factory/re_state_factory.go

This file was deleted.

58 changes: 0 additions & 58 deletions pkg/factory/re_us_post_regions_factory.go

This file was deleted.

19 changes: 5 additions & 14 deletions pkg/factory/us_post_region_city_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ package factory

import (
"github.com/gobuffalo/pop/v6"
"github.com/gofrs/uuid"

"github.com/transcom/mymove/pkg/models"
"github.com/transcom/mymove/pkg/testdatagen"
)

// Creates a UsPostRegionCity for Beverly Hills, California 90210
// Creates a UsPostRegionCity for MacDill AFB, Florida
func BuildUsPostRegionCity(db *pop.Connection, customs []Customization, traits []Trait) models.UsPostRegionCity {
customs = setupCustomizations(customs, traits)

Expand All @@ -20,19 +19,11 @@ func BuildUsPostRegionCity(db *pop.Connection, customs []Customization, traits [
}
}

city := BuildCity(db, customs, nil)
usPostRegion := BuildUsPostRegion(db, customs, nil)

usPostRegionCity := models.UsPostRegionCity{
ID: uuid.Must(uuid.NewV4()),
UsprZipID: "90210",
USPostRegionCityNm: "Beverly Hills",
UsprcCountyNm: "LOS ANGELES",
UsprZipID: "33608",
USPostRegionCityNm: "MacDill AFB",
UsprcCountyNm: "Hillsborough",
CtryGencDgphCd: "US",
City: city,
CityId: city.ID,
UsPostRegion: usPostRegion,
UsPostRegionId: usPostRegion.ID,
}

testdatagen.MergeModels(&usPostRegionCity, cUsPostRegionCity)
Expand All @@ -44,7 +35,7 @@ func BuildUsPostRegionCity(db *pop.Connection, customs []Customization, traits [
return usPostRegionCity
}

// Creates a default UsPostRegionCity for Beverly Hills, California 90210
// Creates a default UsPostRegionCity for MacDill AFB, Florida
func BuildDefaultUsPostRegionCity(db *pop.Connection) models.UsPostRegionCity {
return BuildUsPostRegionCity(db, nil, nil)
}
29 changes: 0 additions & 29 deletions pkg/factory/us_post_region_city_factory_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/db-truncate
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DO \$\$ DECLARE
r RECORD;
BEGIN
FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()
AND tablename NOT IN ('us_post_region_cities', 're_countries')) LOOP
AND tablename NOT IN ('us_post_region_cities', 're_countries', 're_states', 're_cities', 're_us_post_regions', 're_oconus_rate_areas', 're_intl_transit_times')) LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(r.tablename) || ' CASCADE';
END LOOP;
END \$\$;
Expand Down

0 comments on commit 2fcb030

Please sign in to comment.