Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Explicitly export vehicleFactory #2751

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/tests/components/app.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { ConnectionStatus } from "../../src/hooks/useSocket"
import { initialState } from "../../src/state"
import routeTabFactory from "../factories/routeTab"
import useVehicles from "../../src/hooks/useVehicles"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import { MemoryRouter } from "react-router-dom"
import { vehiclePropertiesPanelHeader } from "../testHelpers/selectors/components/vehiclePropertiesPanel"
import stateFactory from "../factories/applicationState"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/groupedAutocomplete.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
SearchProperties,
searchPropertyDisplayConfig,
} from "../../src/models/searchQuery"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import { formatOperatorNameFromVehicle } from "../../src/util/operatorFormatting"
import {
listbox,
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/incomingBox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LadderDirection } from "../../src/models/ladderDirection"
import { Ghost, VehicleInScheduledService } from "../../src/realtime"
import { initialState } from "../../src/state"

import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"
import { render } from "@testing-library/react"
import userEvent from "@testing-library/user-event"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/ladder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { Timepoint } from "../../src/schedule.d"
import { initialState } from "../../src/state"
import * as dateTime from "../../src/util/dateTime"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"
import { render } from "@testing-library/react"
import userEvent from "@testing-library/user-event"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/ladderPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
import { tagManagerEvent } from "../../src/helpers/googleTagManager"
import routeFactory from "../factories/route"
import routeTabFactory, { routeTabPresetFactory } from "../factories/routeTab"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import userEvent from "@testing-library/user-event"
import { VehiclesByRouteIdProvider } from "../../src/contexts/vehiclesByRouteIdContext"
import stateFactory from "../factories/applicationState"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/lateView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { StateDispatchProvider } from "../../src/contexts/stateDispatchContext"
import { VehiclesByRouteIdProvider } from "../../src/contexts/vehiclesByRouteIdContext"
import { State } from "../../src/state"
import blockWaiverFactory from "../factories/blockWaiver"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"
import { tagManagerEvent } from "../../src/helpers/googleTagManager"
import userEvent from "@testing-library/user-event"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/map.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Map, {
} from "../../src/components/map"
import { autoCenter } from "../../src/components/map/follower"
import { TrainVehicle, VehicleInScheduledService } from "../../src/realtime"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import stopFactory from "../factories/stop"

import userEvent from "@testing-library/user-event"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/mapMarkers.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
VehicleMarker,
} from "../../src/components/mapMarkers"
import stopFactory from "../factories/stop"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import trainVehicleFactory from "../factories/trainVehicle"
import { render, screen } from "@testing-library/react"
import React from "react"
Expand Down
3 changes: 2 additions & 1 deletion assets/tests/components/mapPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ import {
searchQueryVehicleFactory,
} from "../factories/searchQuery"
import stopFactory from "../factories/stop"
import vehicleFactory, {
import {
vehicleFactory,
randomLocationVehicle,
shuttleFactory,
} from "../factories/vehicle"
Expand Down
3 changes: 2 additions & 1 deletion assets/tests/components/mapPage/mapDisplay.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import routeFactory from "../../factories/route"
import { routePatternFactory } from "../../factories/routePattern"
import { runIdFactory } from "../../factories/run"
import stopFactory from "../../factories/stop"
import vehicleFactory, {
import {
vehicleFactory,
randomLocationVehicle,
shuttleFactory,
} from "../../factories/vehicle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from "react"
import { render, screen, within } from "@testing-library/react"
import "@testing-library/jest-dom/jest-globals"
import SearchResultsByCategory from "../../../src/components/mapPage/searchResultsByCategory"
import vehicleFactory from "../../factories/vehicle"
import { vehicleFactory } from "../../factories/vehicle"
import { StateDispatchProvider } from "../../../src/contexts/stateDispatchContext"
import stateFactory from "../../factories/applicationState"
import { searchPageStateFactory } from "../../factories/searchPageState"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react"
import { render, screen, waitFor } from "@testing-library/react"
import "@testing-library/jest-dom/jest-globals"
import * as dateTime from "../../../src/util/dateTime"
import vehicleFactory, { shuttleFactory } from "../../factories/vehicle"
import { vehicleFactory, shuttleFactory } from "../../factories/vehicle"
import routeFactory from "../../factories/route"
import VehiclePropertiesCard from "../../../src/components/mapPage/vehiclePropertiesCard"
import { useNearestIntersectionFetchResult } from "../../../src/hooks/useNearestIntersection"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/propertiesList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PropertiesList, {
} from "../../src/components/propertiesList"
import { Ghost, VehicleInScheduledService } from "../../src/realtime"
import * as dateTime from "../../src/util/dateTime"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"
import { render } from "@testing-library/react"

Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/propertiesPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { RoutesProvider } from "../../src/contexts/routesContext"
import { Ghost, Vehicle, VehicleInScheduledService } from "../../src/realtime"
import { Route } from "../../src/schedule"
import * as dateTime from "../../src/util/dateTime"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"
import routeFactory from "../factories/route"
import useVehicleForId from "../../src/hooks/useVehicleForId"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/propertiesPanel/header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from "../../../src/realtime"
import { Route } from "../../../src/schedule"
import { initialState } from "../../../src/state"
import vehicleFactory from "../../factories/vehicle"
import { vehicleFactory } from "../../factories/vehicle"
import ghostFactory from "../../factories/ghost"
import routeFactory from "../../factories/route"
import routeTabFactory from "../../factories/routeTab"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/propertiesPanel/miniMap.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@jest/globals"
import React from "react"
import { VehicleInScheduledService } from "../../../src/realtime"
import vehicleFactory from "../../factories/vehicle"
import { vehicleFactory } from "../../factories/vehicle"
import { render, screen } from "@testing-library/react"
import "@testing-library/jest-dom/jest-globals"
import MiniMap from "../../../src/components/propertiesPanel/miniMap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { initialState } from "../../../src/state"
import pieceFactory from "../../factories/piece"
import { RunFactory } from "../../factories/run"
import { DeadheadTripFactory, TripFactory } from "../../factories/trip"
import vehicleFactory from "../../factories/vehicle"
import { vehicleFactory } from "../../factories/vehicle"
import { mockUseStateOnce } from "../../testHelpers/mockHelpers"

jest.mock("../../../src/hooks/useMinischedule", () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, test, expect, jest } from "@jest/globals"
import React from "react"
import { render, screen } from "@testing-library/react"
import StaleDataPropertiesPanel from "../../../src/components/propertiesPanel/staleDataPropertiesPanel"
import vehicleFactory from "../../factories/vehicle"
import { vehicleFactory } from "../../factories/vehicle"
import blockWaiverFactory from "../../factories/blockWaiver"
import {
useMinischeduleBlock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from "react"
import { render } from "@testing-library/react"
import TabPanels from "../../../src/components/propertiesPanel/tabPanels"
import { VehicleInScheduledService } from "../../../src/realtime"
import vehicleFactory from "../../factories/vehicle"
import { vehicleFactory } from "../../factories/vehicle"

const vehicle: VehicleInScheduledService = vehicleFactory.build({
id: "vehicleId",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from "../../../src/realtime"
import { Route } from "../../../src/schedule"
import * as dateTime from "../../../src/util/dateTime"
import vehicleFactory, { invalidVehicleFactory } from "../../factories/vehicle"
import { vehicleFactory, invalidVehicleFactory } from "../../factories/vehicle"
import { render, screen } from "@testing-library/react"
import "@testing-library/jest-dom/jest-globals"
import { TabMode } from "../../../src/components/propertiesPanel/tabPanels"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/rightPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import RightPanel from "../../src/components/rightPanel"
import * as dateTime from "../../src/util/dateTime"

import ghostFactory from "../factories/ghost"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import { RunFactory } from "../factories/run"
import { OpenView } from "../../src/state/pagePanelState"

Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/routeLadder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from "../../src/realtime.d"
import { Route } from "../../src/schedule.d"
import { initialState } from "../../src/state"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"
import routeFactory from "../factories/route"
import userEvent from "@testing-library/user-event"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/routeVariantName.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import routeFactory from "../factories/route"
import { RouteVariantName } from "../../src/components/routeVariantName"
import { RoutesProvider } from "../../src/contexts/routesContext"
import { Route } from "../../src/schedule"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"

describe("RouteVariantName", () => {
test("renders for a vehicle with variant and headsign", () => {
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/searchForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
option as autocompleteOption,
} from "../testHelpers/selectors/components/groupedAutocomplete"
import { useAutocompleteResults } from "../../src/hooks/useAutocompleteResults"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import { SearchPropertyQuery } from "../../src/models/searchQuery"
import { formatOperatorName } from "../../src/util/operatorFormatting"
import locationSearchSuggestionFactory from "../factories/locationSearchSuggestion"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/searchResults.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as dateTime from "../../src/util/dateTime"
import "@testing-library/jest-dom/jest-globals"

import ghostFactory from "../factories/ghost"
import vehicleFactory, { shuttleFactory } from "../factories/vehicle"
import { vehicleFactory, shuttleFactory } from "../factories/vehicle"
import { searchPageStateFactory } from "../factories/searchPageState"

jest.mock("userTestGroups", () => ({
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/shuttlePicker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
selectShuttleRoute,
selectShuttleRun,
} from "../../src/state"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import { render } from "@testing-library/react"
import userEvent from "@testing-library/user-event"

Expand Down
2 changes: 1 addition & 1 deletion assets/tests/components/swingsView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { render } from "@testing-library/react"
import "@testing-library/jest-dom/jest-globals"
import renderer from "react-test-renderer"
import ghostFactory from "../factories/ghost"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import routeFactory from "../factories/route"
import swingFactory from "../factories/swing"
import SwingsView from "../../src/components/swingsView"
Expand Down
3 changes: 2 additions & 1 deletion assets/tests/components/vehicleRouteSummary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { VehicleRouteSummary } from "../../src/components/vehicleRouteSummary"
import { RoutesProvider } from "../../src/contexts/routesContext"
import ghostFactory from "../factories/ghost"
import routeFactory from "../factories/route"
import vehicleFactory, {
import {
vehicleFactory,
invalidVehicleFactory,
shuttleFactory,
} from "../factories/vehicle"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/contexts/notificationsContext.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { StateDispatchProvider } from "../../src/contexts/stateDispatchContext"
import useCurrentTime from "../../src/hooks/useCurrentTime"
import { Notification, NotificationState } from "../../src/realtime.d"
import { initialState } from "../../src/state"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import { tagManagerEvent } from "../../src/helpers/googleTagManager"
import { useNotifications } from "../../src/hooks/useNotifications"
import notificationFactory from "../factories/notification"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/factories/pagePanelStateFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
initialPageViewState,
} from "../../src/state/pagePanelState"
import { DeepPartial, Factory } from "fishery"
import vehicleFactory from "./vehicle"
import { vehicleFactory } from "./vehicle"

class ViewFactory extends Factory<ViewState> {
currentState(currentState: DeepPartial<PageViewState>) {
Expand Down
4 changes: 1 addition & 3 deletions assets/tests/factories/vehicle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ export const centerLocationVehicle = randomLocationVehicle.params({
longitude: defaultCenter.lng,
})

const vehicleFactory = centerLocationVehicle

export default vehicleFactory
export const vehicleFactory = centerLocationVehicle

export const shuttleFactory = vehicleFactory.params({
isShuttle: true,
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/helpers/vehicleLabel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import vehicleLabel, {
} from "../../src/helpers/vehicleLabel"
import { VehicleInScheduledService } from "../../src/realtime"
import { UserSettings, VehicleLabelSetting } from "../../src/userSettings"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"

const vehicle: VehicleInScheduledService = vehicleFactory.build({
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/hooks/useMostRecentVehicleById.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { makeMockSocket } from "../testHelpers/socketHelpers"
import { renderHook } from "@testing-library/react"
import useVehicleForId from "../../src/hooks/useVehicleForId"
import useMostRecentVehicleById from "../../src/hooks/useMostRecentVehicleById"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import { Ghost, Vehicle, VehicleId } from "../../src/realtime"

jest.mock("../../src/hooks/useVehicleForId", () => ({
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/hooks/usePanelState.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
usePanelStateForViewState,
usePanelStateFromStateDispatchContext,
} from "../../src/hooks/usePanelState"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import {
OpenView,
PagePath,
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/hooks/useSearchResultsByCategory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { jest, describe, test, expect, afterEach } from "@jest/globals"
import { renderHook } from "@testing-library/react"
import { useSearchResults } from "../../src/hooks/useSearchResults"
import { makeMockSocket } from "../testHelpers/socketHelpers"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import useSearchResultsByCategory, {
VehicleResultType,
} from "../../src/hooks/useSearchResultsByCategory"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/models/vehicle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "../../src/models/vehicle"
import { Ghost, VehicleInScheduledService } from "../../src/realtime"
import * as dateTime from "../../src/util/dateTime"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"
import routeFactory from "../factories/route"

Expand Down
2 changes: 1 addition & 1 deletion assets/tests/models/vehicleStatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
defaultUserSettings,
VehicleAdherenceColorsSetting,
} from "../../src/userSettings"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"

describe("onTimeStatus", () => {
test("returns on-time", () => {
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/models/vehiclesByPosition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Ghost,
VehicleInScheduledService,
} from "../../src/realtime.d"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import ghostFactory from "../factories/ghost"

describe("groupByPosition", () => {
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/state.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from "../src/userSettings"
import { RouteTab } from "../src/models/routeTab"

import vehicleFactory from "./factories/vehicle"
import { vehicleFactory } from "./factories/vehicle"
import routeTabFactory from "./factories/routeTab"
import stateFactory from "./factories/applicationState"
import {
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/state/pagePanelState.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, describe, test } from "@jest/globals"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"
import {
OpenView,
PagePath,
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/util/operatorFormatting.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
formatOperatorName,
formatOperatorNameFromVehicle,
} from "../../src/util/operatorFormatting"
import vehicleFactory from "../factories/vehicle"
import { vehicleFactory } from "../factories/vehicle"

describe("formatOperatorName", () => {
test("when given non-null data, should return formatted operator name", () => {
Expand Down
Loading