pkgdash/internal/analyzer/coverage/coverage_test.go
Vasiliy Tolstov 07f67fd1d7 move to text logger
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2024-12-07 16:21:00 +03:00

38 lines
747 B
Go

package coverage
import (
"context"
"os"
"testing"
"github.com/stretchr/testify/assert"
"go.unistack.org/pkgdash/internal/models"
)
func Test_Calculate(t *testing.T) {
file, err := os.Open("cover_test.out")
assert.Nil(t, err)
defer func() {
assert.Nil(t, file.Close())
}()
dataFiles, err := calculateFiles(file)
assert.Nil(t, err)
assert.NotNil(t, dataFiles)
}
func Test_Analyze(t *testing.T) {
file, err := os.Open("cover_test.out")
assert.Nil(t, err)
defer func() {
assert.Nil(t, file.Close())
}()
analyze, err := Analyze(context.Background(), file, models.Package{
Name: "go.unistack.org/micro/v3",
URL: "https://git.unistack.org/unistack-org/micro.git",
})
assert.Nil(t, err)
assert.Equal(t, analyze, 0.0)
}