43 lines
1.5 KiB
Go
43 lines
1.5 KiB
Go
package loader
|
|
|
|
import (
|
|
"bytes"
|
|
_ "embed"
|
|
"testing"
|
|
|
|
"github.com/matryer/is"
|
|
)
|
|
|
|
//go:embed test/testfile.xlsx
|
|
var tb []byte
|
|
|
|
func TestXLSX(t *testing.T) {
|
|
is := is.New(t)
|
|
buf := bytes.NewBuffer(tb)
|
|
got, err := XLSX(buf, nil)
|
|
is.NoErr(err) // no error for testfile
|
|
is.Equal(got.Version, "5.04") // version 5.04
|
|
is.Equal(got.CompanyFacts.TotalPurchaseFromSuppliers, 10000)
|
|
is.Equal(got.CompanyFacts.SupplyFractions[0].Costs, 500)
|
|
is.Equal(got.CompanyFacts.SupplyFractions[0].CountryCode, "ALB")
|
|
is.Equal(got.CompanyFacts.FinancialCosts, 12)
|
|
is.Equal(got.CompanyFacts.EmployeesFractions[1].CountryCode, "AUT")
|
|
|
|
is.Equal(got.Matrix.Topics[0].ShortName, "A1")
|
|
is.Equal(got.Matrix.Topics[0].MaxPoints, 44)
|
|
is.Equal(got.Matrix.Topics[4].ShortName, "B1")
|
|
is.Equal(got.Matrix.Topics[4].Points, 27)
|
|
is.Equal(got.Matrix.Topics[4].MaxPoints, 33)
|
|
is.Equal(got.Matrix.Topics[4].PercentageReached, 80)
|
|
is.Equal(got.Matrix.Topics[5].Points, 2) // points B2
|
|
is.Equal(got.Matrix.Topics[5].MaxPoints, 22) // maxPoints B2
|
|
is.Equal(got.Matrix.Topics[5].PercentageReached, 10) // percent B2
|
|
is.Equal(got.Matrix.Topics[6].Points, 10) // points B3
|
|
is.Equal(got.Matrix.Topics[6].MaxPoints, 33) // maxPoints B3
|
|
is.Equal(got.Matrix.Topics[6].PercentageReached, 30) // percent B3
|
|
is.Equal(got.Matrix.Topics[7].Points, 2) // points B4
|
|
is.Equal(got.Matrix.Topics[7].MaxPoints, 22) // maxPoints B4
|
|
is.Equal(got.Matrix.Topics[7].PercentageReached, 10) // percent B4
|
|
|
|
}
|