mardi 30 mars 2021

how to populate a test function with given input-golang

I have the following code

func TestBookingListing_provisionHistory(t *testing.T) {
    Setup(false)

    b := Booking{
        
        Status: StatusActive,
    
        ListingIDs: []int64{1, 2},
    }

    for _, l := range b.ListingIDs {

        bl := BookingListing{
            BookingID:   b.ID,
            ListingID:   l,
            Created:     b.Created,
            Status:      StatusPending,
            RequestedBy: "Jane",
            Type:        b.Type,
            Updated:     b.Created,
        }

        
        if Status(bl.RequestedBy) != StatusExpired {

            t.Error("expecting status of bookinglisting to be requested")

        }

    }
}

I need to display the name of Requestedby in when the status is not expired. How can this be done thanking in advance

Aucun commentaire:

Enregistrer un commentaire