Skip to content

Commit

Permalink
refactor(forecast): abbr pellets
Browse files Browse the repository at this point in the history
  • Loading branch information
Forceh91 committed Nov 8, 2023
1 parent 0fb2196 commit efe8cd0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/__tests__/abbreviateForecast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ describe("Forecast Truncation", () => {
"100% chnc of flrys"
);
expect(abbreviateForecast("5 percent chance of flurries", forecastLengthWanted)).toStrictEqual("5% chnc of flrys");
expect(abbreviateForecast("rain mixed with ice pellets", forecastLengthWanted)).toStrictEqual(
"rain mixed w/ ice plts"
);
});

test("Compass directions", () => {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/conditions/forecast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ const abbreviateWinterConditions = (forecast: string) =>
.replace(/blowing snow/gi, "blwg snow")
.replace(/flurries/gi, "flrys")
.replace(/freezing drizzle/gi, "frzg drzl")
.replace(/freezing rain/gi, "frzg rain");
.replace(/freezing rain/gi, "frzg rain")
.replace(/pellets/gi, "plts");

const finalAbbreviationAttempt = (forecast: string) => forecast.replace(/kmh/gi, "");

Expand Down

0 comments on commit efe8cd0

Please sign in to comment.