Skip to content

Commit

Permalink
feedback: remove unused helper
Browse files Browse the repository at this point in the history
  • Loading branch information
thecristen committed Oct 30, 2023
1 parent 7c45f07 commit 29d34fb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
10 changes: 0 additions & 10 deletions apps/site/assets/ts/ui/__tests__/autocomplete-helpers-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import { Route, Stop } from "../../__v3api";
import {
ContentItem,
Item,
LocationItem,
RouteItem,
StopItem
} from "../autocomplete/__autocomplete";
import {
getItemType,
getTitleAttribute,
transitNearMeURL,
onStateChange
Expand All @@ -22,14 +20,6 @@ import {
const testRouteItem = { route: {} as Route } as RouteItem;
const testStopItem = { stop: {} as Stop } as StopItem;
const testContentItem = { _content_type: "events" } as ContentItem;
const testLocationItem = { address: "" } as LocationItem;

test("getItemType infers type from the item's properties", () => {
expect(getItemType(testRouteItem)).toEqual("routes");
expect(getItemType(testStopItem)).toEqual("stops");
expect(getItemType(testContentItem)).toEqual("drupal");
expect(getItemType(testLocationItem)).toEqual("locations");
});

test("getTitleAttribute indicates name to highlight", () => {
expect(getTitleAttribute(testRouteItem as Hit<Item>)).toEqual([
Expand Down
7 changes: 0 additions & 7 deletions apps/site/assets/ts/ui/autocomplete/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,6 @@ export function isContentItem(x: Item): x is ContentItem {
return Object.keys(x).includes("_content_type");
}

export const getItemType = (item: Item): string => {
if (isStopItem(item)) return "stops";
if (isRouteItem(item)) return "routes";
if (isContentItem(item)) return "drupal";
return "locations";
};

export const getTitleAttribute = (item: Item): string[] => {
if (isStopItem(item)) {
return ["stop", "name"];
Expand Down

0 comments on commit 29d34fb

Please sign in to comment.