jx/internal/resource/common_test.go
Matthew Rich 8094d1c063
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 build support to container_image resource; add more testing
2024-09-19 08:11:57 +00:00

28 lines
677 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package resource
import (
"github.com/stretchr/testify/assert"
"testing"
"net/url"
)
func TestNewCommon(t *testing.T) {
c := NewCommon()
assert.NotNil(t, c)
}
func TestCommon(t *testing.T) {
for _, v := range []struct{ uri string; expected Common }{
{ uri: "file:///tmp/foo", expected: Common{ resourceType: "file", Uri: "file:///tmp/foo", parsedURI: &url.URL{ Scheme: "file", Path: "/tmp/foo"}, Path: "/tmp/foo" } },
}{
c := NewCommon()
c.resourceType = "file"
assert.Nil(t, c.SetURI(v.uri))
assert.Equal(t, v.expected.Path, c.Path)
assert.Equal(t, &v.expected, c)
}
}