hackforla / lucky-parking

Visualization of parking data to assist in understanding of the effects of parking policies on a neighborhood by neighborhood basis in the City of Los Angeles
https://www.hackforla.org/projects/lucky-parking.html
33 stars 60 forks source link

Testing Coverage for Geocoder Utilities #617

Closed christianjro closed 7 months ago

christianjro commented 7 months ago

Description

Created utilities.test.tsx file to test the Geocoder Utilities file (packages/website/src/features/geocoder/lib/utilities.ts). I made tests for the following scenarios:

Related Issues

Resolves #578

Testing

 PASS  src/features/geocoder/lib/utilities.test.tsx
  Forward Geocode Neighborhood Council
    ✓ should return an empty array for a query string that does not match any neighborhood council (3 ms)
    ✓ should return the same results for a query string regardless of case (1 ms)
    ✓ should return neighborhood councils that partially match the query
    ✓ should return an array of GeocodeResult type for input query string (4 ms)

 PASS  src/features/instructions/how-it-works-button.test.tsx
  Modal and click modal trigger
    ✓ renders title (68 ms)
    ✓ renders description (29 ms)
    ✓ renders SearchIcon (25 ms)
    ✓ renders SearchIcon's title (22 ms)
    ✓ renders SearchIcon's first list text (18 ms)
    ✓ renders SearchIcon's second list text (18 ms)
    ✓ renders DrawIcon (18 ms)
    ✓ renders DrawIcons's title (20 ms)
    ✓ renders CompareIcon (23 ms)
    ✓ renders CompareIcons's title (24 ms)
    ✓ renders with close button (24 ms)
    ✓ pressing close button closes modal (34 ms)

 PASS  src/widgets/radius-tool/radius-tool.test.tsx
  Radius Tool UI
    ✓ renders default Select Option (35 ms)
    ✓ renders default input (8 ms)
    ✓ renders apply button (6 ms)
  Radius Tool Interaction
    ✓ renders select list (70 ms)
    ✓ should render Feet (68 ms)
    ✓ should convert miles to feet (58 ms)
    ✓ should convert miles to kilometer (57 ms)
    ✓ should convert miles to meter (64 ms)

 PASS  ../ui/src/components/modal/modal.test.tsx
  Default Modal and click modal trigger
    ✓ renders announcement icon (65 ms)
    ✓ renders title (27 ms)
    ✓ renders description (23 ms)
    ✓ renders content test (22 ms)
    ✓ renders submit button (22 ms)
    ✓ clicking submit button closes modal (34 ms)
    ✓ renders close trigger button (27 ms)
    ✓ clicking close trigger button should close modal (38 ms)
  Custom Modal Description and Title and click modal trigger
    ✓ renders custom title (21 ms)
    ✓ renders custom description (21 ms)

 PASS  ../ui/src/components/date-input/date-input.test.tsx
  Date Input
    ✓ renders Calendar component when clicking date input component (85 ms)
    ✓ clicking outside of Calendar component closes calendar (53 ms)
    ✓ date input child prop works correctly - 'From' label (33 ms)
    ✓ date input placeholder text is 'mm/dd/yy' (27 ms)
    ✓ date input value in the Calendar component is today's date by default (42 ms)
    ✓ date input value updates when date is selected in Calendar (261 ms)

 PASS  src/shared/lib/utilities/date.test.ts
  Date Utilities
    calculateDateRange
      ✓ calculates one year to now (1 ms)
      ✓ calculates year to now
      ✓ calculates three months to now
      ✓ calculates one month to now (1 ms)

 PASS  src/features/citation/ui/citation-data-category-selection.test.tsx
  Citation-data-category-selection rendering
    ✓ should render citation data categories with initial placeholder (17 ms)
    ✓ should render all citation data categories options (108 ms)
  Citation-data-category-selection interactions
    ✓ should not render with default option (75 ms)
    ✓ should render with selected option (67 ms)
    ✓ should return selected option (67 ms)

 PASS  src/features/citation/ui/citation-date-presets-selection.test.tsx
  Citation-date-presets-selection rendering
    ✓ should render citation date presets with initial placeholder (17 ms)
    ✓ should render all citation date presets options (80 ms)
  Citation-date-presets-selection interactions
    ✓ should not render with default option (57 ms)
    ✓ should render with selected option (57 ms)
    ✓ should return selected option (84 ms)

 PASS  ../ui/src/components/pick-list/pick-list.test.tsx
  Pick List
    ✓ renders placeholder text (13 ms)
    ✓ renders ArrowDropDown icon (8 ms)
  Pick List's User Interaction
    ✓ renders ArrowDropUp icon (78 ms)
    ✓ renders list of items (46 ms)

 PASS  ../ui/src/components/radio-group/radio-group.test.tsx
  Radio Group Component
    ✓ renders radio group and all it's options (18 ms)
    ✓ able to select and re-slect one radio option at a time (79 ms)
    ✓ should return the selected option (6 ms)

 PASS  src/widgets/header/header.test.tsx
  Header
    ✓ renders with branding (13 ms)
    ✓ renders with description (5 ms)
    ✓ renders with action button (2 ms)

 PASS  ../utilities/src/date.test.ts
  Date Utilities
    formatToMiddleEndian
      ✓ formats to middle-endian date format  (3 ms)
    formatToRangeString
      ✓ formats to date range string

 PASS  src/features/geocoder/ui/search-mode-toggle-button.test.tsx
  Search Mode Toggle Button
    ✓ renders visibly (14 ms)
    ✓ invokes onclick handler when clicked (21 ms)

 PASS  ../ui/src/components/stepper/stepper.test.tsx
  Renders Step Component
    ✓ renders check icon (11 ms)
    ✓ renders 1 finished circle (7 ms)
    ✓ renders 1 inProgress circle (1 ms)
    ✓ renders 1 incomplete circle (4 ms)
    ✓ renders first Step title (1 ms)
    ✓ renders first content text (1 ms)

 PASS  ../ui/src/components/input/input.test.tsx
  Input
    ✓ renders input value value (1 ms)

 PASS  src/features/geocoder/ui/region-types-selection.test.tsx
  Region Types Selection
    ✓ should render all available Region Types (14 ms)
    ✓ should allow user select specific region type (7 ms)

 PASS  ../utilities/src/enum.test.ts
  Enum Utilities
    getNth
      ✓ gets the nth enum (1 ms)
      ✓ returns undefined for out-of-bounds nth
    getFirst
      ✓ gets first enum
      ✓ returns undefined for empty enum

 PASS  src/features/geocoder/api/endpoints.test.tsx
  Endpoint Testing
    ✓ should outline forward geocoding endpoint
    ✓ should correctly build a forward geocoding endpoint url with params (1 ms)

 PASS  ../utilities/src/string.test.ts
  String Utilities
    isSubstring
      ✓ handles without case-sensitivity (1 ms)
      ✓ handles with case-sensitivity

 PASS  src/pages/page.test.tsx
  Page
    ✓ renders content (4 ms)

 PASS  src/features/citation/ui/citation-data-filter.test.tsx
  Citation-data-filter
    rendering
      ✓ renders citation data categories with initial placeholder (43 ms)
      ✓ renders citation date presets with initial placeholder (12 ms)
      ✓ renders date inputs with initial placeholders (13 ms)
    interactions
      ✓ should not render with default options (809 ms)
      ✓ should render with selected options (541 ms)
      ✓ should return selected options (471 ms)

Test Suites: 21 passed, 21 total
Tests:       92 passed, 92 total
Snapshots:   0 total
Time:        3.418 s
Ran all test suites.

Checklist

netlify[bot] commented 7 months ago

Deploy Preview for lucky-parking-staging-storybook failed.

Name Link
Latest commit 2ccef544471c57ebd403a2d471ca8b685653ea6c
Latest deploy log https://app.netlify.com/sites/lucky-parking-staging-storybook/deploys/65ca617539fb170008f21686
netlify[bot] commented 7 months ago

Deploy Preview for lucky-parking-staging ready!

Name Link
Latest commit
Latest deploy log https://app.netlify.com/sites/lucky-parking-staging/deploys/65cd90b8fbdf02632d5859b7
Deploy Preview https://deploy-preview-617--lucky-parking-staging.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

glenflorendo commented 7 months ago

I'm working on resolving the Netlify issues. I think it's caused by a previous change I made.

glenflorendo commented 7 months ago

Netflix is fixed, but I'm not sure how to rerun the checks. I clicked retry, but nothing is happening.

Link to Netflify rebuild.