Revert "Upgrade linter and formatter to Ultracite" (#1226)

This commit is contained in:
josh 2025-09-21 12:03:29 +01:00 committed by GitHub
parent 0e320b391d
commit 1aff7d9868
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
177 changed files with 8334 additions and 6943 deletions

View file

@ -1,52 +1,52 @@
import type { Document } from "@/lib/db/schema";
import { getMessageByErrorCode } from "@/lib/errors";
import { generateUUID } from "@/lib/utils";
import { expect, test } from "../fixtures";
import type { Document } from '@/lib/db/schema';
import { generateUUID } from '@/lib/utils';
import { expect, test } from '../fixtures';
import { getMessageByErrorCode } from '@/lib/errors';
const documentsCreatedByAda: Document[] = [];
const documentsCreatedByAda: Array<Document> = [];
test.describe
.serial("/api/document", () => {
test("Ada cannot retrieve a document without specifying an id", async ({
.serial('/api/document', () => {
test('Ada cannot retrieve a document without specifying an id', async ({
adaContext,
}) => {
const response = await adaContext.request.get("/api/document");
const response = await adaContext.request.get('/api/document');
expect(response.status()).toBe(400);
const { code, message } = await response.json();
expect(code).toEqual("bad_request:api");
expect(code).toEqual('bad_request:api');
expect(message).toEqual(getMessageByErrorCode(code));
});
test("Ada cannot retrieve a document that does not exist", async ({
test('Ada cannot retrieve a document that does not exist', async ({
adaContext,
}) => {
const documentId = generateUUID();
const response = await adaContext.request.get(
`/api/document?id=${documentId}`
`/api/document?id=${documentId}`,
);
expect(response.status()).toBe(404);
const { code, message } = await response.json();
expect(code).toEqual("not_found:document");
expect(code).toEqual('not_found:document');
expect(message).toEqual(getMessageByErrorCode(code));
});
test("Ada can create a document", async ({ adaContext }) => {
test('Ada can create a document', async ({ adaContext }) => {
const documentId = generateUUID();
const draftDocument = {
title: "Ada's Document",
kind: "text",
content: "Created by Ada",
kind: 'text',
content: 'Created by Ada',
};
const response = await adaContext.request.post(
`/api/document?id=${documentId}`,
{
data: draftDocument,
}
},
);
expect(response.status()).toBe(200);
@ -56,11 +56,11 @@ test.describe
documentsCreatedByAda.push(createdDocument);
});
test("Ada can retrieve a created document", async ({ adaContext }) => {
test('Ada can retrieve a created document', async ({ adaContext }) => {
const [document] = documentsCreatedByAda;
const response = await adaContext.request.get(
`/api/document?id=${document.id}`
`/api/document?id=${document.id}`,
);
expect(response.status()).toBe(200);
@ -71,22 +71,22 @@ test.describe
expect(retrievedDocument).toMatchObject(document);
});
test("Ada can save a new version of the document", async ({
test('Ada can save a new version of the document', async ({
adaContext,
}) => {
const [firstDocument] = documentsCreatedByAda;
const draftDocument = {
title: "Ada's Document",
kind: "text",
content: "Updated by Ada",
kind: 'text',
content: 'Updated by Ada',
};
const response = await adaContext.request.post(
`/api/document?id=${firstDocument.id}`,
{
data: draftDocument,
}
},
);
expect(response.status()).toBe(200);
@ -96,13 +96,13 @@ test.describe
documentsCreatedByAda.push(createdDocument);
});
test("Ada can retrieve all versions of her documents", async ({
test('Ada can retrieve all versions of her documents', async ({
adaContext,
}) => {
const [firstDocument, secondDocument] = documentsCreatedByAda;
const response = await adaContext.request.get(
`/api/document?id=${firstDocument.id}`
`/api/document?id=${firstDocument.id}`,
);
expect(response.status()).toBe(200);
@ -115,39 +115,39 @@ test.describe
expect(secondRetrievedDocument).toMatchObject(secondDocument);
});
test("Ada cannot delete a document without specifying an id", async ({
test('Ada cannot delete a document without specifying an id', async ({
adaContext,
}) => {
const response = await adaContext.request.delete("/api/document");
const response = await adaContext.request.delete(`/api/document`);
expect(response.status()).toBe(400);
const { code, message } = await response.json();
expect(code).toEqual("bad_request:api");
expect(code).toEqual('bad_request:api');
expect(message).toEqual(getMessageByErrorCode(code));
});
test("Ada cannot delete a document without specifying a timestamp", async ({
test('Ada cannot delete a document without specifying a timestamp', async ({
adaContext,
}) => {
const [firstDocument] = documentsCreatedByAda;
const response = await adaContext.request.delete(
`/api/document?id=${firstDocument.id}`
`/api/document?id=${firstDocument.id}`,
);
expect(response.status()).toBe(400);
const { code, message } = await response.json();
expect(code).toEqual("bad_request:api");
expect(code).toEqual('bad_request:api');
expect(message).toEqual(getMessageByErrorCode(code));
});
test("Ada can delete a document by specifying id and timestamp", async ({
test('Ada can delete a document by specifying id and timestamp', async ({
adaContext,
}) => {
const [firstDocument, secondDocument] = documentsCreatedByAda;
const response = await adaContext.request.delete(
`/api/document?id=${firstDocument.id}&timestamp=${firstDocument.createdAt}`
`/api/document?id=${firstDocument.id}&timestamp=${firstDocument.createdAt}`,
);
expect(response.status()).toBe(200);
@ -158,13 +158,13 @@ test.describe
expect(deletedDocument).toMatchObject(secondDocument);
});
test("Ada can retrieve documents without deleted versions", async ({
test('Ada can retrieve documents without deleted versions', async ({
adaContext,
}) => {
const [firstDocument] = documentsCreatedByAda;
const response = await adaContext.request.get(
`/api/document?id=${firstDocument.id}`
`/api/document?id=${firstDocument.id}`,
);
expect(response.status()).toBe(200);
@ -180,20 +180,20 @@ test.describe
const draftDocument = {
title: "Babbage's Document",
kind: "text",
content: "Created by Babbage",
kind: 'text',
content: 'Created by Babbage',
};
const response = await babbageContext.request.post(
`/api/document?id=${firstDocument.id}`,
{
data: draftDocument,
}
},
);
expect(response.status()).toBe(403);
const { code, message } = await response.json();
expect(code).toEqual("forbidden:document");
expect(code).toEqual('forbidden:document');
expect(message).toEqual(getMessageByErrorCode(code));
});
@ -201,7 +201,7 @@ test.describe
const [firstDocument] = documentsCreatedByAda;
const response = await adaContext.request.get(
`/api/document?id=${firstDocument.id}`
`/api/document?id=${firstDocument.id}`,
);
expect(response.status()).toBe(200);