MCPcopy Create free account
hub / github.com/astercloud/aster / TestFromMetadata

Function TestFromMetadata

pkg/memory/provenance_test.go:161–196  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

159}
160
161func TestFromMetadata(t *testing.T) {
162 original := NewProvenance(SourceUserInput, "session-789")
163 original.Tags = []string{"test"}
164 original.Corroborate("session-790")
165
166 meta := original.ToMetadata()
167 restored := FromMetadata(meta)
168
169 if restored == nil {
170 t.Fatal("FromMetadata returned nil")
171 }
172
173 if restored.SourceType != original.SourceType {
174 t.Errorf("SourceType = %v, want %v", restored.SourceType, original.SourceType)
175 }
176
177 if restored.Confidence != original.Confidence {
178 t.Errorf("Confidence = %v, want %v", restored.Confidence, original.Confidence)
179 }
180
181 if len(restored.Sources) != len(original.Sources) {
182 t.Errorf("Sources length = %d, want %d", len(restored.Sources), len(original.Sources))
183 }
184
185 if restored.Version != original.Version {
186 t.Errorf("Version = %v, want %v", restored.Version, original.Version)
187 }
188
189 if restored.CorroborationCount != original.CorroborationCount {
190 t.Errorf("CorroborationCount = %v, want %v", restored.CorroborationCount, original.CorroborationCount)
191 }
192
193 if len(restored.Tags) != len(original.Tags) {
194 t.Errorf("Tags length = %d, want %d", len(restored.Tags), len(original.Tags))
195 }
196}
197
198func TestProvenance_MarkAccessed(t *testing.T) {
199 p := NewProvenance(SourceUserInput, "session-1")

Callers

nothing calls this directly

Calls 4

NewProvenanceFunction · 0.85
FromMetadataFunction · 0.85
CorroborateMethod · 0.80
ToMetadataMethod · 0.80

Tested by

no test coverage detected