Files
dingtalk-workspace-cli/internal/app/schema_source_register_coverage_test.go
T
玉澜andCursor 0a2e49e7e4 fix(schema): separate catalog content hash from surface registry hash
Runtime assemble was stamping Snapshot.SourceHash with the registry
surface hash, so schema --all catalog_hash diverged from the CI dump
content source_hash and failed Policy. Also remap ContractFinal
Interface.Ref onto pinned MCP metadata so interface_type stays aligned.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 12:26:25 +08:00

33 lines
1.1 KiB
Go

// Copyright 2026 Alibaba Group
// Licensed under the Apache License, Version 2.0 (the "License");
package app
import (
"testing"
"github.com/DingTalk-Real-AI/dingtalk-workspace-cli/internal/cli"
)
// TestCrossPlatformCoverageRegisterSchemaRuntimeDelivery covers the production
// RegisterSchemaSourceRoot install path used by NewRootCommand.
func TestCrossPlatformCoverageRegisterSchemaRuntimeDelivery(t *testing.T) {
registerSchemaRuntimeDelivery()
if !cli.SchemaSourceRootRegistered() {
t.Fatal("registerSchemaRuntimeDelivery did not install Schema source root")
}
meta, ok := cli.ResolveMeta("dev app delete")
if !ok || meta.Identity.Canonical == "" {
t.Fatalf("ResolveMeta after registerSchemaRuntimeDelivery = %#v ok=%v", meta, ok)
}
safety, ok := cli.SafetyForCLIPath("dev app delete")
if !ok || safety.Effect == "" {
t.Fatalf("SafetyForCLIPath after register = %#v ok=%v", safety, ok)
}
// Idempotent: Once must not panic or clear the factory.
registerSchemaRuntimeDelivery()
if !cli.SchemaSourceRootRegistered() {
t.Fatal("second registerSchemaRuntimeDelivery cleared Schema source root")
}
}