Skip to content

Commit

Permalink
Merge pull request #17 from navidys/unit_tests
Browse files Browse the repository at this point in the history
unit tests
  • Loading branch information
navidys authored Nov 14, 2023
2 parents 1976baa + cf4ee3a commit 5e3c177
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tracks.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func GetTrackByAircraft(ctx context.Context, icao24 string, time int64) (FlightT
}

if time < 0 {
return flightTrack, ErrInvalidAircraftName
return flightTrack, ErrInvalidUnixTime
}

conn, err := getClient(ctx)
Expand Down
25 changes: 25 additions & 0 deletions tracks_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package gopensky_test

import (
"context"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/navidys/gopensky"
)

var _ = Describe("Tracks", func() {
Describe("GetTrackByAircraft", func() {
It("retrieves the trajectory for a certain aircraft at a given time", func() {
conn, err := gopensky.NewConnection(context.Background(), "", "")
Expect(err).NotTo(HaveOccurred())

_, err = gopensky.GetTrackByAircraft(conn, "", 1696755342)
Expect(err).To(Equal(gopensky.ErrInvalidAircraftName))

_, err = gopensky.GetTrackByAircraft(conn, "a835af", -1)
Expect(err).To(Equal(gopensky.ErrInvalidUnixTime))
})
})
})

0 comments on commit 5e3c177

Please sign in to comment.