Skip to content

Commit

Permalink
eventually everything will be typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Apr 16, 2024
1 parent 298cd11 commit 615249c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/lib/api/notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function list(doc_id, fetch) {
* @param {globalThis.fetch} fetch
* @returns {Promise<import('./types').Note>}
*/
export async function get(doc_id, note_id, fetch) {
export async function get(doc_id, note_id, fetch = globalThis.fetch) {
const endpoint = new URL(
`documents/${doc_id}/notes/${note_id}.json`,
BASE_API_URL,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/forms/tests/DocumentUpload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("DocumentUpload form", () => {
});
await act(() => fireEvent(dropElement, dropEvent));
const fileListItem = screen.getByRole("listitem");
expect(fileListItem).toContainHTML("128 kB");
expect(fileListItem).toContain("128 kB");
});
it("provides feedback when a file is too large", async () => {
render(DocumentUploadForm);
Expand All @@ -39,6 +39,6 @@ describe("DocumentUpload form", () => {
});
await act(() => fireEvent(dropElement, dropEvent));
const fileListItem = screen.getByRole("listitem");
expect(fileListItem).toContainHTML("The maximum size for a PDF is 500MB");
expect(fileListItem).toContain("The maximum size for a PDF is 500MB");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as notesApi from "$lib/api/notes.js";
/** @type {import('./$types').PageLoad} */
export async function load({ params, url, fetch }) {
const [document, note] = await Promise.all([
documents.get(params.id, fetch),
notesApi.get(params.id, params.note_id),
documents.get(+params.id, fetch),
notesApi.get(+params.id, params.note_id, fetch),
]);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import * as notesApi from "$lib/api/notes.js";

/** @type {import('./$types').PageLoad} */
export async function load({ params, fetch }) {
const { page } = params;
const page = +params.page;
let [document, notes] = await Promise.all([
documents.get(params.id, fetch),
notesApi.list(params.id, fetch),
documents.get(+params.id, fetch),
notesApi.list(+params.id, fetch),
]);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as projects from "$lib/api/projects.js";
/** @type {import('./$types').PageLoad} */
export async function load({ params, fetch }) {
const [project, documents] = await Promise.all([
projects.get(params.project_id, fetch),
projects.documents(params.project_id, fetch),
projects.get(+params.project_id, fetch),
projects.documents(+params.project_id, fetch),
]);

return {
Expand Down

0 comments on commit 615249c

Please sign in to comment.