Rename files, add nil item check
This commit is contained in:
parent
8025d4aa9a
commit
efe8a9e1d2
@ -20,7 +20,6 @@ type LiteDriveItemable interface {
|
||||
GetId() *string
|
||||
GetName() *string
|
||||
GetSize() *int64
|
||||
// TODO(pandeyabs): replace with any
|
||||
GetFolder() interface{}
|
||||
GetPackageEscaped() interface{}
|
||||
GetShared() interface{}
|
||||
@ -204,6 +203,10 @@ var downloadURLKeys = []string{
|
||||
}
|
||||
|
||||
func ToLiteDriveItemable(item models.DriveItemable) LiteDriveItemable {
|
||||
if item == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
cdi := &driveItem{
|
||||
id: strings.Clone(ptr.Val(item.GetId())),
|
||||
name: strings.Clone(ptr.Val(item.GetName())),
|
||||
@ -39,6 +39,19 @@ func (suite *driveUnitSuite) TestToLiteDriveItemable() {
|
||||
expected models.DriveItemable,
|
||||
got LiteDriveItemable)
|
||||
}{
|
||||
{
|
||||
name: "nil item",
|
||||
itemFunc: func() models.DriveItemable {
|
||||
return nil
|
||||
},
|
||||
validateFunc: func(
|
||||
t *testing.T,
|
||||
expected models.DriveItemable,
|
||||
got LiteDriveItemable,
|
||||
) {
|
||||
require.Nil(t, got)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "uninitialized values",
|
||||
itemFunc: func() models.DriveItemable {
|
||||
Loading…
x
Reference in New Issue
Block a user