mirror of
https://github.com/kennethnym/aris.git
synced 2026-06-16 20:41:18 +01:00
feat: seed default user sources (#128)
This commit is contained in:
@@ -18,7 +18,7 @@ describe("LocationSource", () => {
|
||||
describe("FeedSource interface", () => {
|
||||
test("has correct id", () => {
|
||||
const source = new LocationSource()
|
||||
expect(source.id).toBe("freya.location")
|
||||
expect(source.id).toBe(LocationSource.id)
|
||||
})
|
||||
|
||||
test("fetchItems always returns empty array", async () => {
|
||||
|
||||
@@ -5,8 +5,6 @@ import { type } from "arktype"
|
||||
|
||||
import { Location, type LocationSourceOptions } from "./types.ts"
|
||||
|
||||
export const LocationKey: ContextKey<Location> = contextKey("freya.location", "location")
|
||||
|
||||
/**
|
||||
* A FeedSource that provides location context.
|
||||
*
|
||||
@@ -16,7 +14,9 @@ export const LocationKey: ContextKey<Location> = contextKey("freya.location", "l
|
||||
* Does not produce feed items - always returns empty array from `fetchItems`.
|
||||
*/
|
||||
export class LocationSource implements FeedSource {
|
||||
readonly id = "freya.location"
|
||||
static readonly id = "freya.location"
|
||||
|
||||
readonly id = LocationSource.id
|
||||
|
||||
private readonly historySize: number
|
||||
private locations: Location[] = []
|
||||
@@ -97,3 +97,5 @@ export class LocationSource implements FeedSource {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
export const LocationKey: ContextKey<Location> = contextKey(LocationSource.id, "location")
|
||||
|
||||
@@ -37,7 +37,7 @@ describe("WebSearchSource", () => {
|
||||
test("has correct id", () => {
|
||||
const source = new WebSearchSource({ client: new RecordingSearchClient() })
|
||||
|
||||
expect(source.id).toBe("freya.web-search")
|
||||
expect(source.id).toBe(WebSearchSource.id)
|
||||
})
|
||||
|
||||
test("does not provide context or feed items", async () => {
|
||||
|
||||
@@ -41,7 +41,9 @@ const SearchInput = type({
|
||||
* action and receive structured web results.
|
||||
*/
|
||||
export class WebSearchSource implements FeedSource {
|
||||
readonly id = "freya.web-search"
|
||||
static readonly id = "freya.web-search"
|
||||
|
||||
readonly id = WebSearchSource.id
|
||||
|
||||
private readonly client: WebSearchClient
|
||||
|
||||
|
||||
Reference in New Issue
Block a user