> I still don't know what I need to change in the testing stub

I would guess:

```ruby
  def stub_straight_routing(start_instruction: "Start here", 
finish_instruction: "Finish there")
    stub_routing <<~CALLBACK
      const distance = points[0].distanceTo(points[1]);
      const time = distance * 30;
      return Promise.resolve({
        line: points,
        steps: [
          [points[0],  8, "<b>1.</b> #{start_instruction}", distance, points],
          [points[1], 14, "<b>2.</b> #{finish_instruction}", 0, [points[1]]]
        ],
        distance,
        time
      });
    CALLBACK
  end

  def stub_routing(callback_code)
    execute_script <<~SCRIPT
      $(() => {
        for (const engine of OSM.Directions.engines) {
          engine.getRoute = (points, signal) => {
              #{callback_code}
          };
        }
      });
    SCRIPT
  end
end


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5642#issuecomment-2650757462
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5642/c2650757...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to