You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
scrutiny/webapp/backend/pkg/models/collector/smart_test.go

34 lines
696 B

package collector
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestSmartInfo_Capacity(t *testing.T) {
t.Run("should report nvme capacity", func(t *testing.T) {
smartInfo := SmartInfo{
UserCapacity: UserCapacity{
Bytes: 1234,
},
NvmeTotalCapacity: 5678,
}
assert.Equal(t, int64(5678), smartInfo.Capacity())
})
t.Run("should report user capacity", func(t *testing.T) {
smartInfo := SmartInfo{
UserCapacity: UserCapacity{
Bytes: 1234,
},
}
assert.Equal(t, int64(1234), smartInfo.Capacity())
})
t.Run("should report 0 for unknown capacities", func(t *testing.T) {
var smartInfo SmartInfo
assert.Zero(t, smartInfo.Capacity())
})
}