jx/internal/folio/resourcereference_test.go
Matthew Rich 04b27dc5df
Some checks failed
Lint / golangci-lint (push) Has been cancelled
Declarative Tests / test (push) Has been cancelled
Declarative Tests / build-fedora (push) Has been cancelled
Declarative Tests / build-ubuntu-focal (push) Has been cancelled
add folio package
2024-08-17 18:19:56 -07:00

31 lines
686 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. 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 = TempDir
f.Size = 10
d := NewDeclaration()
d.Type = "foo"
d.Attributes = f
resourceMapper[d.URI()] = d
var foo ResourceReference = ResourceReference(fmt.Sprintf("foo://%s", TempDir))
u := foo.Parse()
assert.Equal(t, "foo", u.Scheme)
assert.True(t, foo.Exists())
fromRef := foo.Lookup(resourceMapper)
assert.NotNil(t, fromRef)
}