add calculate and merge coverage files
This commit is contained in:
36
internal/analyzer/coverage/coverage_test.go
Normal file
36
internal/analyzer/coverage/coverage_test.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package coverage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.unistack.org/unistack-org/pkgdash/internal/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
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/v4",
|
||||
URL: "https://git.unistack.org/unistack-org/micro.git",
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, analyze, 0.0)
|
||||
}
|
||||
Reference in New Issue
Block a user