Skip to content

Commit ac63173

Browse files
vojtabiberleclaude
andcommitted
DMD-919 - Wrap TestFetchAll assertions in expectedData structure
Refactor TestFetchAll to use a single expectedData comparison instead of multiple individual assertions, for cleaner and more maintainable tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent aa5f133 commit ac63173

1 file changed

Lines changed: 30 additions & 7 deletions

File tree

internal/pkg/llm/twinformat/fetcher_test.go

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,37 @@ func TestFetchAll(t *testing.T) {
479479
data, err := fetcher.FetchAll(t.Context(), branchID)
480480
require.NoError(t, err)
481481

482-
assert.Equal(t, keboola.ProjectID(12345), data.ProjectID)
483-
assert.Equal(t, branchID, data.BranchID)
482+
// Verify FetchedAt is set (can't compare exactly due to runtime value)
484483
assert.NotZero(t, data.FetchedAt)
485-
assert.Len(t, data.Buckets, 1)
486-
assert.Len(t, data.Tables, 1)
487-
assert.Empty(t, data.Jobs)
488-
assert.Empty(t, data.TransformationConfigs)
489-
assert.Empty(t, data.ComponentConfigs)
484+
485+
expectedData := &ProjectData{
486+
ProjectID: 12345,
487+
BranchID: branchID,
488+
FetchedAt: data.FetchedAt, // Copy actual value for comparison
489+
Buckets: []*keboola.Bucket{
490+
{
491+
BucketKey: keboola.BucketKey{
492+
BranchID: branchID,
493+
BucketID: keboola.BucketID{Stage: keboola.BucketStageIn, BucketName: "bucket"},
494+
},
495+
},
496+
},
497+
Tables: []*keboola.Table{
498+
{
499+
TableKey: keboola.TableKey{
500+
BranchID: branchID,
501+
TableID: keboola.TableID{
502+
BucketID: keboola.BucketID{Stage: keboola.BucketStageIn, BucketName: "bucket"},
503+
TableName: "table1",
504+
},
505+
},
506+
},
507+
},
508+
Jobs: []*keboola.QueueJob{},
509+
TransformationConfigs: []*TransformationConfig{},
510+
ComponentConfigs: []*ComponentConfig{},
511+
}
512+
assert.Equal(t, expectedData, data)
490513
}
491514

492515
func TestFetchAll_JobsFailure_ReturnsEmptyJobs(t *testing.T) {

0 commit comments

Comments
 (0)