Skip to content

Commit

Permalink
test: fix existing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Luthfi Fahlevi committed Aug 11, 2024
1 parent 5994448 commit 2eee272
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/store/postgres/asset_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -977,11 +977,12 @@ func (r *AssetRepositoryTestSuite) TestUpsert() {
r.Run("on insert", func() {
r.Run("set ID to asset and version to base version", func() {
ast := asset.Asset{
URN: "urn-u-1",
Type: "table",
Service: "bigquery",
URL: "https://sample-url.com",
UpdatedBy: r.users[0],
URN: "urn-u-1",
Type: "table",
Service: "bigquery",
URL: "https://sample-url.com",
UpdatedBy: r.users[0],
RefreshedAt: time.Now(),
}
id, err := r.repository.Upsert(r.ctx, &ast)
r.Equal(asset.BaseVersion, ast.Version)
Expand All @@ -998,6 +999,7 @@ func (r *AssetRepositoryTestSuite) TestUpsert() {
r.assertAsset(&ast, &assetInDB)

ast2 := ast
ast2.RefreshedAt = time.Now()
ast2.Description = "create a new version" // to force fetch from asset_versions.
_, err = r.repository.Upsert(r.ctx, &ast2)
r.NoError(err)
Expand Down Expand Up @@ -1915,11 +1917,13 @@ func (r *AssetRepositoryTestSuite) assertAsset(expectedAsset, actualAsset *asset
// sanitize time to make the assets comparable
expectedAsset.CreatedAt = time.Time{}
expectedAsset.UpdatedAt = time.Time{}
expectedAsset.RefreshedAt = time.Time{}
expectedAsset.UpdatedBy.CreatedAt = time.Time{}
expectedAsset.UpdatedBy.UpdatedAt = time.Time{}

actualAsset.CreatedAt = time.Time{}
actualAsset.UpdatedAt = time.Time{}
actualAsset.RefreshedAt = time.Time{}
actualAsset.UpdatedBy.CreatedAt = time.Time{}
actualAsset.UpdatedBy.UpdatedAt = time.Time{}

Expand Down

0 comments on commit 2eee272

Please sign in to comment.