Skip to content

Commit 02fd7bb

Browse files
committed
chore(cas): inline single-use test helper
Assisted-by: Claude Code Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev> Chainloop-Trace-Sessions: 0c60a332-e0f1-4c2b-94ae-533467e52f5c
1 parent c098da7 commit 02fd7bb

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

app/artifact-cas/internal/service/auditor_test.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ func TestAuditDispatcherDispatch(t *testing.T) {
119119
// must never panic nor return an error
120120
tc.dispatcher.Dispatch(tc.entry, tc.claims)
121121

122-
fake, ok := publisherAsFake(tc.dispatcher)
123-
if !ok {
122+
if tc.dispatcher == nil || tc.dispatcher.publisher == nil {
124123
return
125124
}
125+
fake := tc.dispatcher.publisher.(*fakePublisher)
126126

127127
require.Len(t, fake.published, tc.wantPublished)
128128
if tc.wantPublished == 0 {
@@ -161,15 +161,6 @@ func TestAuditDispatcherShouldEmit(t *testing.T) {
161161
}
162162
}
163163

164-
func publisherAsFake(d *AuditDispatcher) (*fakePublisher, bool) {
165-
if d == nil || d.publisher == nil {
166-
return nil, false
167-
}
168-
169-
fake, ok := d.publisher.(*fakePublisher)
170-
return fake, ok
171-
}
172-
173164
// artifactEventInfo mirrors the action info payload of CAS artifact events for assertions
174165
type artifactEventInfo struct {
175166
Digest string `json:"digest"`

0 commit comments

Comments
 (0)