34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import type { RawInternship } from "../src/domain/internship.js";
|
|
import { type Catalog, emptyCatalog } from "../src/domain/internship.js";
|
|
import type { CatalogStore } from "../src/store/catalogStore.js";
|
|
|
|
export function raw(overrides: Partial<RawInternship> = {}): RawInternship {
|
|
return {
|
|
title: "Guest Service Intern",
|
|
organization: "Hotel Alpina",
|
|
country: "Швейцария",
|
|
city: "Церматт",
|
|
field: "Отель",
|
|
funding: "full",
|
|
coveredExpenses: "Проживание, питание, перелёт",
|
|
participationFee: null,
|
|
language: "russian",
|
|
languageDetails: "Русский",
|
|
customerService: true,
|
|
deadline: null,
|
|
sourceUrl: "https://example.org/alpina",
|
|
rationale: "Подходит",
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
export class MemoryStore implements CatalogStore {
|
|
constructor(public catalog: Catalog = emptyCatalog()) {}
|
|
async load(): Promise<Catalog> {
|
|
return structuredClone(this.catalog);
|
|
}
|
|
async save(catalog: Catalog): Promise<void> {
|
|
this.catalog = structuredClone(catalog);
|
|
}
|
|
}
|