go-blockchain/forge_test.go
Claude a328c9f859
Some checks are pending
Security Scan / security (push) Waiting to run
Test / Test (push) Waiting to run
test: add tests for service, dns, forge, alias, blockdata (6 files)
service_test.go: NewBlockchainService, seedToRPC routing
dns_test.go: DNSRecord struct
forge_test.go: publish_release, dispatch_build, no-version error
chain/alias_test.go: PutGet round-trip, GetAll, NotFound error
chain/blockdata_test.go: WriteAtomic (no temp left), EnsureDir

21 untested files → 15 remaining. Closing gaps systematically.

Co-Authored-By: Charon <charon@lethean.io>
2026-04-02 03:54:45 +01:00

34 lines
808 B
Go

package blockchain
import (
"context"
"testing"
"dappco.re/go/core"
)
func TestForge_PublishRelease_Good(t *testing.T) {
opts := core.NewOptions(core.Option{Key: "version", Value: "0.3.0"})
result := forgePublishRelease(context.Background(), opts)
if !result.OK {
t.Error("expected OK")
}
}
func TestForge_PublishRelease_Bad_NoVersion(t *testing.T) {
result := forgePublishRelease(context.Background(), core.Options{})
if result.OK {
t.Error("expected failure without version")
}
}
func TestForge_DispatchBuild_Good(t *testing.T) {
result := forgeDispatchBuild(context.Background(), core.Options{})
if !result.OK {
t.Error("expected OK")
}
m := result.Value.(map[string]interface{})
if m["target"] != "testnet" {
t.Errorf("default target: got %v, want testnet", m["target"])
}
}