This is an automated email from the ASF dual-hosted git repository.

LinkinStars pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git

commit 16249581a209124777befe652280873c52807626
Author: seiya <[email protected]>
AuthorDate: Thu Oct 15 13:11:49 2026 +0000

    test: expose swallowed revision lookup error
    
    Co-Authored-By: codex <[email protected]>
---
 internal/service/content/revision_service_test.go | 51 +++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/internal/service/content/revision_service_test.go 
b/internal/service/content/revision_service_test.go
new file mode 100644
index 00000000..9545b583
--- /dev/null
+++ b/internal/service/content/revision_service_test.go
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package content
+
+import (
+       "context"
+       "errors"
+       "testing"
+
+       "github.com/apache/answer/internal/entity"
+       "github.com/apache/answer/internal/schema"
+       "github.com/apache/answer/internal/service/revision"
+)
+
+type checkCanUpdateRevisionErrorRepo struct {
+       revision.RevisionRepo
+       err error
+}
+
+func (r *checkCanUpdateRevisionErrorRepo) 
ExistUnreviewedByObjectID(context.Context, string) (*entity.Revision, bool, 
error) {
+       return nil, false, r.err
+}
+
+func TestCheckCanUpdateRevisionPropagatesLookupError(t *testing.T) {
+       wantErr := errors.New("revision lookup failed")
+       service := &RevisionService{
+               revisionRepo: &checkCanUpdateRevisionErrorRepo{err: wantErr},
+       }
+
+       _, err := service.CheckCanUpdateRevision(context.Background(), 
&schema.CheckCanQuestionUpdate{ID: "1"})
+       if !errors.Is(err, wantErr) {
+               t.Fatalf("CheckCanUpdateRevision() error = %v, want %v", err, 
wantErr)
+       }
+}

Reply via email to