mirror of
https://github.com/kennethnym/aris.git
synced 2026-03-20 17:11:17 +00:00
fix: use PascalCase for FeedItemType members (#51)
Rename camelCase members to PascalCase in WeatherFeedItemType and CalendarFeedItemType to match TflFeedItemType and CalDavFeedItemType conventions. Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
@@ -3,10 +3,10 @@ import type { FeedItem } from "@aris/core"
|
||||
import type { Certainty, ConditionCode, PrecipitationType, Severity, Urgency } from "./weatherkit"
|
||||
|
||||
export const WeatherFeedItemType = {
|
||||
current: "weather-current",
|
||||
hourly: "weather-hourly",
|
||||
daily: "weather-daily",
|
||||
alert: "weather-alert",
|
||||
Current: "weather-current",
|
||||
Hourly: "weather-hourly",
|
||||
Daily: "weather-daily",
|
||||
Alert: "weather-alert",
|
||||
} as const
|
||||
|
||||
export type WeatherFeedItemType = (typeof WeatherFeedItemType)[keyof typeof WeatherFeedItemType]
|
||||
@@ -28,7 +28,7 @@ export type CurrentWeatherData = {
|
||||
}
|
||||
|
||||
export interface CurrentWeatherFeedItem extends FeedItem<
|
||||
typeof WeatherFeedItemType.current,
|
||||
typeof WeatherFeedItemType.Current,
|
||||
CurrentWeatherData
|
||||
> {}
|
||||
|
||||
@@ -49,7 +49,7 @@ export type HourlyWeatherData = {
|
||||
}
|
||||
|
||||
export interface HourlyWeatherFeedItem extends FeedItem<
|
||||
typeof WeatherFeedItemType.hourly,
|
||||
typeof WeatherFeedItemType.Hourly,
|
||||
HourlyWeatherData
|
||||
> {}
|
||||
|
||||
@@ -68,7 +68,7 @@ export type DailyWeatherData = {
|
||||
}
|
||||
|
||||
export interface DailyWeatherFeedItem extends FeedItem<
|
||||
typeof WeatherFeedItemType.daily,
|
||||
typeof WeatherFeedItemType.Daily,
|
||||
DailyWeatherData
|
||||
> {}
|
||||
|
||||
@@ -86,7 +86,7 @@ export type WeatherAlertData = {
|
||||
}
|
||||
|
||||
export interface WeatherAlertFeedItem extends FeedItem<
|
||||
typeof WeatherFeedItemType.alert,
|
||||
typeof WeatherFeedItemType.Alert,
|
||||
WeatherAlertData
|
||||
> {}
|
||||
|
||||
|
||||
@@ -110,9 +110,9 @@ describe("WeatherSource", () => {
|
||||
const items = await source.fetchItems(context)
|
||||
|
||||
expect(items.length).toBeGreaterThan(0)
|
||||
expect(items.some((i) => i.type === WeatherFeedItemType.current)).toBe(true)
|
||||
expect(items.some((i) => i.type === WeatherFeedItemType.hourly)).toBe(true)
|
||||
expect(items.some((i) => i.type === WeatherFeedItemType.daily)).toBe(true)
|
||||
expect(items.some((i) => i.type === WeatherFeedItemType.Current)).toBe(true)
|
||||
expect(items.some((i) => i.type === WeatherFeedItemType.Hourly)).toBe(true)
|
||||
expect(items.some((i) => i.type === WeatherFeedItemType.Daily)).toBe(true)
|
||||
})
|
||||
|
||||
test("applies hourly and daily limits", async () => {
|
||||
@@ -125,8 +125,8 @@ describe("WeatherSource", () => {
|
||||
|
||||
const items = await source.fetchItems(context)
|
||||
|
||||
const hourlyItems = items.filter((i) => i.type === WeatherFeedItemType.hourly)
|
||||
const dailyItems = items.filter((i) => i.type === WeatherFeedItemType.daily)
|
||||
const hourlyItems = items.filter((i) => i.type === WeatherFeedItemType.Hourly)
|
||||
const dailyItems = items.filter((i) => i.type === WeatherFeedItemType.Daily)
|
||||
|
||||
expect(hourlyItems.length).toBe(3)
|
||||
expect(dailyItems.length).toBe(2)
|
||||
@@ -158,7 +158,7 @@ describe("WeatherSource", () => {
|
||||
expect(item.signals!.timeRelevance).toBeDefined()
|
||||
}
|
||||
|
||||
const currentItem = items.find((i) => i.type === WeatherFeedItemType.current)
|
||||
const currentItem = items.find((i) => i.type === WeatherFeedItemType.Current)
|
||||
expect(currentItem).toBeDefined()
|
||||
expect(currentItem!.signals!.urgency).toBeGreaterThanOrEqual(0.5)
|
||||
})
|
||||
|
||||
@@ -291,7 +291,7 @@ function createCurrentWeatherFeedItem(
|
||||
|
||||
return {
|
||||
id: `weather-current-${timestamp.getTime()}`,
|
||||
type: WeatherFeedItemType.current,
|
||||
type: WeatherFeedItemType.Current,
|
||||
timestamp,
|
||||
data: {
|
||||
conditionCode: current.conditionCode,
|
||||
@@ -325,7 +325,7 @@ function createHourlyWeatherFeedItem(
|
||||
|
||||
return {
|
||||
id: `weather-hourly-${timestamp.getTime()}-${index}`,
|
||||
type: WeatherFeedItemType.hourly,
|
||||
type: WeatherFeedItemType.Hourly,
|
||||
timestamp,
|
||||
data: {
|
||||
forecastTime: new Date(hourly.forecastStart),
|
||||
@@ -359,7 +359,7 @@ function createDailyWeatherFeedItem(
|
||||
|
||||
return {
|
||||
id: `weather-daily-${timestamp.getTime()}-${index}`,
|
||||
type: WeatherFeedItemType.daily,
|
||||
type: WeatherFeedItemType.Daily,
|
||||
timestamp,
|
||||
data: {
|
||||
forecastDate: new Date(daily.forecastStart),
|
||||
@@ -386,7 +386,7 @@ function createWeatherAlertFeedItem(alert: WeatherAlert, timestamp: Date): Weath
|
||||
|
||||
return {
|
||||
id: `weather-alert-${alert.id}`,
|
||||
type: WeatherFeedItemType.alert,
|
||||
type: WeatherFeedItemType.Alert,
|
||||
timestamp,
|
||||
data: {
|
||||
alertId: alert.id,
|
||||
|
||||
Reference in New Issue
Block a user