jx/internal/source/docsource_test.go

49 lines
857 B
Go
Raw Normal View History

2024-04-18 00:07:12 +00:00
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package source
import (
_ "context"
_ "fmt"
"github.com/stretchr/testify/assert"
_ "log"
"testing"
2024-04-19 07:52:10 +00:00
"os"
"log"
2024-04-18 00:07:12 +00:00
)
2024-04-19 07:52:10 +00:00
var TempDir string
func TestMain(m *testing.M) {
var err error
TempDir, err = os.MkdirTemp("", "testdocsourcefile")
if err != nil || TempDir == "" {
log.Fatal(err)
}
rc := m.Run()
os.RemoveAll(TempDir)
os.Exit(rc)
}
2024-04-18 00:07:12 +00:00
func TestNewDocSource(t *testing.T) {
resourceUri := "tar://foo"
testFile := NewDocSource(resourceUri)
assert.NotNil(t, testFile)
}
/*
func TestResolveId(t *testing.T) {
testFile := NewResource("file://../../README.md")
assert.NotNil(t, testFile)
absolutePath, e := filepath.Abs("../../README.md")
assert.Nil(t, e)
testFile.ResolveId(context.Background())
assert.Equal(t, absolutePath, testFile.(*File).Path)
}
*/