Skip to content

Instantly share code, notes, and snippets.

@dylanmaryk
Created September 19, 2018 13:57
Show Gist options
  • Save dylanmaryk/403cbf71e114fb2a560f02dd7d273278 to your computer and use it in GitHub Desktop.
Save dylanmaryk/403cbf71e114fb2a560f02dd7d273278 to your computer and use it in GitHub Desktop.
describe("route to result card header component view model mapper test") {
context("when the route is a walking route") {
let route = Route.mockWalkingRoute
let departureDate = (route.segments?.first?.stops?.first?.scheduledDate)!
context("when the route is in less than 15 minutes") {
let currentDate = calendar.date(byAdding: .minute, value: -14, to: departureDate)!
let model = mapper.resultCardHeaderComponentViewModel(for: route, currentDate: currentDate)
it("returns a route type string for walking") {
expect(model.routeType).to(equal("Walk"))
}
it("returns a departure string for the route") {
expect(model.departureTime.string).to(equal("Get going in 14 min"))
}
it("returns a route duration string for the route") {
expect(model.routeDuration).to(equal("42"))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment