import { InMemoryLocationRepository } from "../adapters/inMemoryLocationsRepository";
import Location from "../entities/location";
import { DummyPresenter } from "./createLocation.test";
import showLocations from "./showLocations";

describe("use case showsLocations", () => {
  it("show every locations", () => {
    const repository = new InMemoryLocationRepository([
      new Location("Rouen", 49.443232, 1.099971),
      new Location("Bourg-Achard", 49.35322, 0.81623),
    ]);
    const presenter = new DummyPresenter<Location[]>();

    showLocations(repository, presenter);

    expect(presenter.result).not.toBeUndefined();
    expect(presenter.result).toHaveLength(2);
  });
});
