Get front end tests passing (#299)

* chore: get front end tests passing

* chore: add @vue/runtime-core to fix types for $t

* chore: sort lockfile

* Discard changes to frontend/pnpm-lock.yaml

* chore: sort lockfile

* chore: fix some type errors

* chore: switch from nuxi typecheck to vue-tsc to force a known good version

* chore: linting

* chore: update pnpm version in frontend test

* feat: add proper pagination type (need to sort why it still doesn't work)

* chore: format imports and initialize totalPrice in label page to null when no label is present

* chore: update pnpm to v9.12.2, merge ItemSummaryPaginationResult with PaginationResult, and handle error in label generator more gracefully

* chore: lint

---------

Co-authored-by: Matt Kilgore <matthew@kilgore.dev>
This commit is contained in:
Tonya
2024-10-28 19:47:00 +00:00
committed by GitHub
parent c0860fc9ca
commit ec5b6bb8ff
31 changed files with 237 additions and 160 deletions

View File

@@ -148,9 +148,7 @@ describe("user should be able to create an item and add an attachment", () => {
{
const { response, data } = await api.items.maintenance.getLog(item.id);
expect(response.status).toBe(200);
expect(data.entries).toHaveLength(maintenanceEntries.length);
expect(data.costAverage).toBeGreaterThan(0);
expect(data.costTotal).toBeGreaterThan(0);
expect(data).toHaveLength(maintenanceEntries.length);
}
cleanup();

View File

@@ -12,7 +12,7 @@ import type {
MaintenanceEntryCreate,
MaintenanceEntryWithDetails,
} from "../types/data-contracts";
import type { AttachmentTypes, PaginationResult } from "../types/non-generated";
import type { AttachmentTypes, ItemSummaryPaginationResult } from "../types/non-generated";
import type { MaintenanceFilters } from "./maintenance.ts";
import type { Requests } from "~~/lib/requests";
@@ -98,7 +98,7 @@ export class ItemsApi extends BaseAPI {
}
getAll(q: ItemsQuery = {}) {
return this.http.get<PaginationResult<ItemSummary>>({ url: route("/items", q) });
return this.http.get<ItemSummaryPaginationResult<ItemSummary>>({ url: route("/items", q) });
}
create(item: ItemCreate) {

View File

@@ -16,3 +16,7 @@ export interface PaginationResult<T> {
pageSize: number;
total: number;
}
export interface ItemSummaryPaginationResult<T> extends PaginationResult<T> {
totalPrice: number;
}