Files
Rogeeandrogee 2b182f9956 H-300: wire Captain Skills into Web runtime (#48)
* H-300: wire Captain Skills into Web runtime

* H-300: enforce effective model and conservative skill budget

* H-300: fix CI gosec step

* ci: extend golangci-lint timeout

* fix lint findings across backend

* fix(push): resolve delivery protocol blockers

* test(repository): close SQLite test databases

* test(repository): reuse SQLite schema per package

* H-307: restore backend Go cache in CI

* H-307: prefetch modules before cold lint

* H-307: resolve govulncheck security gate

* H-307: build lint with patched Go toolchain

* H-307: clear remaining security scan findings

---------

Co-authored-by: Rogee <rogee@ipao.vip>
2026-08-19 07:08:14 +08:00

66 lines
1.5 KiB
Go

package main
import (
"os"
"path/filepath"
"testing"
)
func TestReadRouteDump_NotFound_Cov1(t *testing.T) {
_, err := readRouteDump("/nonexistent/path")
if err == nil {
t.Error("expected error for nonexistent file")
}
}
func TestReadRouteDump_Valid_Cov1(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "routes.txt")
if err := os.WriteFile(path, []byte("GET /api/v1/accounts\nPOST /api/v1/users\nTOTAL: 2\n\n"), 0644); err != nil {
t.Fatal(err)
}
routes, err := readRouteDump(path)
if err != nil {
t.Fatal(err)
}
if len(routes) != 2 {
t.Errorf("expected 2 routes, got %d", len(routes))
}
}
func TestReadRouteDump_Empty_Cov1(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "empty.txt")
if err := os.WriteFile(path, []byte(""), 0644); err != nil {
t.Fatal(err)
}
routes, err := readRouteDump(path)
if err != nil {
t.Fatal(err)
}
if len(routes) != 0 {
t.Errorf("expected 0 routes, got %d", len(routes))
}
}
func TestExtractChatwootDecls_NotFound_Cov1(t *testing.T) {
_, err := extractChatwootDecls("/nonexistent/path")
if err == nil {
t.Error("expected error for nonexistent path")
}
}
func TestWriteChatwootSource_Cov1(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "output.txt")
err := writeChatwootSource(path, "test", []sourceDecl{{Line: 1, Text: "test"}})
_ = err
}
func TestWriteParity_Cov1(t *testing.T) {
dir := t.TempDir()
path := filepath.Join(dir, "parity.md")
err := writeParity(path, "gochat", "chatwoot", map[string]route{})
_ = err
}