MCPcopy Create free account
hub / github.com/github/gh-aw / TestGenerateLockMetadata

Function TestGenerateLockMetadata

pkg/workflow/lock_schema_test.go:282–304  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

280}
281
282func TestGenerateLockMetadata(t *testing.T) {
283 // Save and restore original values
284 originalIsRelease := isReleaseBuild
285 originalVersion := compilerVersion
286 defer func() {
287 isReleaseBuild = originalIsRelease
288 compilerVersion = originalVersion
289 }()
290
291 // Test dev build (default)
292 SetIsRelease(false)
293 SetVersion("dev")
294 hash := "abcd1234"
295 stopTime := "2026-02-17 20:00:00"
296 metadata := GenerateLockMetadata(LockHashInfo{FrontmatterHash: hash}, stopTime, false, AgentMetadataInfo{})
297
298 assert.NotNil(t, metadata, "Metadata should be created")
299 assert.Equal(t, LockSchemaV4, metadata.SchemaVersion, "Should use current schema version")
300 assert.Equal(t, hash, metadata.FrontmatterHash, "Should preserve frontmatter hash")
301 assert.Equal(t, stopTime, metadata.StopTime, "Should preserve stop time")
302 assert.Empty(t, metadata.CompilerVersion, "Dev builds should not include version")
303 assert.False(t, metadata.Strict, "Non-strict build should have Strict=false")
304}
305
306func TestGenerateLockMetadataStrict(t *testing.T) {
307 hash := "abcd1234"

Callers

nothing calls this directly

Calls 3

SetIsReleaseFunction · 0.85
SetVersionFunction · 0.85
GenerateLockMetadataFunction · 0.85

Tested by

no test coverage detected