Skip to content

Commit

Permalink
feat(nav): add format to session started at (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Oct 11, 2023
1 parent 7da0b78 commit 31241e0
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 25 deletions.
2 changes: 1 addition & 1 deletion xfs/nav/navigation-async_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ var _ = Describe("navigation", Ordered, func() {
}

wgan.Wait("👾 test-main")
_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()

if consumer != nil {
Expand Down
8 changes: 4 additions & 4 deletions xfs/nav/navigation-listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var _ = Describe("Listener", Ordered, func() {
reason := fmt.Sprintf("❌ remaining: '%v'", strings.Join(entry.mandatory, ", "))
Expect(len(entry.mandatory)).To(Equal(0), reason)

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
},
func(entry *listenTE) string {
Expand Down Expand Up @@ -237,7 +237,7 @@ var _ = Describe("Listener", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})

Expand Down Expand Up @@ -266,7 +266,7 @@ var _ = Describe("Listener", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down Expand Up @@ -346,7 +346,7 @@ var _ = Describe("Listener", Ordered, func() {
files, folders,
)

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down
9 changes: 7 additions & 2 deletions xfs/nav/navigation-session.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
)

type Session interface {
StartedAt() time.Time
StartedAtTime() time.Time
StartedAt(format string) string
Elapsed() time.Duration
}

Expand All @@ -24,10 +25,14 @@ type session struct {
duration time.Duration
}

func (s *session) StartedAt() time.Time {
func (s *session) StartedAtTime() time.Time {
return s.startAt
}

func (s *session) StartedAt(format string) string {
return s.startAt.Format(format)
}

func (s *session) Elapsed() time.Duration {
return s.duration
}
Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/navigation-with-runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ var _ = Describe("NavigationWithRunner", Ordered, func() {
}

Expect(err).Error().To(BeNil())
_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/resume-strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ var _ = Describe("Resume", Ordered, func() {
folders: result.Metrics.Count(nav.MetricNoFoldersInvokedEn),
}

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
}

Expand Down
14 changes: 7 additions & 7 deletions xfs/nav/traverse-navigator-error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()

})
Expand All @@ -161,7 +161,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down Expand Up @@ -219,7 +219,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down Expand Up @@ -256,7 +256,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down Expand Up @@ -287,7 +287,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() {
fmt.Sprintf("❌ expected error to be path not found, but was: '%v'", err),
)

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down Expand Up @@ -315,7 +315,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() {
Expect(query).To(BeTrue(),
fmt.Sprintf("❌ expected error to be path not found, but was: '%v'", err),
)
_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down Expand Up @@ -349,7 +349,7 @@ var _ = Describe("TraverseNavigator errors", Ordered, func() {
fmt.Sprintf("❌ expected error to be path not found, but was: '%v'", err),
)

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/traverse-navigator-scope_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var _ = Describe("TraverseNavigatorScope", Ordered, func() {
Expect(actual).To(Equal(expected), helpers.Reason(name))
}

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
},
func(entry *scopeTE) string {
Expand Down
6 changes: 3 additions & 3 deletions xfs/nav/traverse-navigator-skip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var _ = Describe("TraverseNavigatorSkip", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand All @@ -60,7 +60,7 @@ var _ = Describe("TraverseNavigatorSkip", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand All @@ -80,7 +80,7 @@ var _ = Describe("TraverseNavigatorSkip", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
},
func(entry *skipTE) string {
Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/traverse-navigator-sort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var _ = Describe("TraverseNavigatorSort", Ordered, func() {
sequence = recording[n]
}

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
},
func(entry *sortTE) string {
Expand Down
6 changes: 3 additions & 3 deletions xfs/nav/traverse-navigator-subpath_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ var _ = Describe("TraverseNavigatorSubpath", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})

Expand Down Expand Up @@ -100,7 +100,7 @@ var _ = Describe("TraverseNavigatorSubpath", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down Expand Up @@ -140,7 +140,7 @@ var _ = Describe("TraverseNavigatorSubpath", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAtTime()
_ = result.Session.Elapsed()
})
})
Expand Down
3 changes: 2 additions & 1 deletion xfs/nav/traverse-navigator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/fs"
"path/filepath"
"strings"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down Expand Up @@ -67,7 +68,7 @@ var _ = Describe("TraverseNavigator(logged)", Ordered, func() {
OptionsFn: optionFn,
}).Run()

_ = result.Session.StartedAt()
_ = result.Session.StartedAt(time.RFC1123)
_ = result.Session.Elapsed()

if entry.visit {
Expand Down

0 comments on commit 31241e0

Please sign in to comment.