// Copyright 2024 Matthew Rich . All rights reserved. package folio import ( "github.com/stretchr/testify/assert" "testing" "fmt" "decl/internal/data" "decl/internal/mapper" ) func TestResourceReference(t *testing.T) { f := NewFooResource() resourceMapper := mapper.New[string, data.Declaration]() f.Name = string(TempDir) f.Size = 10 d := NewDeclaration() d.Type = "foo" d.Attributes = f resourceMapper[d.URI()] = d var foo ResourceReference = ResourceReference(fmt.Sprintf("foo://%s", string(TempDir))) u := foo.Parse() assert.Equal(t, "foo", u.Scheme) assert.True(t, foo.Exists()) fromRef := foo.Lookup(resourceMapper) assert.NotNil(t, fromRef) }