go-container/sources/source_test.go
Virgil 4021325d10 chore: polish ax v0.8.0 compliance
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-26 17:18:44 +00:00

35 lines
956 B
Go

package sources
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSourceConfig_Empty_Good(t *testing.T) {
cfg := SourceConfig{}
assert.Empty(t, cfg.GitHubRepo)
assert.Empty(t, cfg.RegistryImage)
assert.Empty(t, cfg.CDNURL)
assert.Empty(t, cfg.ImageName)
}
func TestSourceConfig_Complete_Good(t *testing.T) {
cfg := SourceConfig{
GitHubRepo: "owner/repo",
RegistryImage: "ghcr.io/owner/image:v1",
CDNURL: "https://cdn.example.com/images",
ImageName: "my-image-darwin-arm64.qcow2",
}
assert.Equal(t, "owner/repo", cfg.GitHubRepo)
assert.Equal(t, "ghcr.io/owner/image:v1", cfg.RegistryImage)
assert.Equal(t, "https://cdn.example.com/images", cfg.CDNURL)
assert.Equal(t, "my-image-darwin-arm64.qcow2", cfg.ImageName)
}
func TestImageSource_Interface_Good(t *testing.T) {
// Ensure both sources implement the interface
var _ ImageSource = (*GitHubSource)(nil)
var _ ImageSource = (*CDNSource)(nil)
}