Selected documents return to drafting, and advance asks the creator to acknowledge an open recheck mark. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
780 B
Go
25 lines
780 B
Go
package docgov
|
|
|
|
import (
|
|
"errors"
|
|
"testing"
|
|
)
|
|
|
|
func TestTransitionReopenForRevision_IsNotARejection(t *testing.T) {
|
|
sm := NewStateMachine()
|
|
doc := &DocumentRecord{DocID: "doc_reopen", CurrentState: StateApproved, IsLocked: true, Config: DefaultDocumentConfig()}
|
|
audit, err := sm.TransitionReopenForRevision(doc, 4, "creator", "新材料")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if doc.CurrentState != StateDrafting || doc.IsLocked {
|
|
t.Fatalf("state %s locked %v", doc.CurrentState, doc.IsLocked)
|
|
}
|
|
if audit.Action != "reopen_for_revision" || audit.ActorRole != RoleSystem {
|
|
t.Fatalf("audit %+v", audit)
|
|
}
|
|
if _, err := sm.TransitionReopenForRevision(doc, 4, "creator", "again"); !errors.Is(err, ErrInvalidStateTransition) {
|
|
t.Fatalf("drafting reopen err %v", err)
|
|
}
|
|
}
|