jx/internal/folio/resourcereference_test.go
Matthew Rich 55fd39f09d
Some checks are pending
Lint / golangci-lint (push) Waiting to run
Declarative Tests / test (push) Waiting to run
Declarative Tests / build-fedora (push) Waiting to run
Declarative Tests / build-ubuntu-focal (push) Waiting to run
add document imports
2024-09-24 19:22:49 +00:00

31 lines
702 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 = 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)
}