Add Prettier and ESLint tooling (Refs #77)

This commit is contained in:
2026-10-09 15:56:13 -04:00
parent 8ed059b8d3
commit 16469e2d43
711 changed files with 99737 additions and 28286 deletions
+30 -9
View File
@@ -10,27 +10,48 @@ beforeEach(() => vi.resetAllMocks());
describe('collection launch routes', () => {
it('loads an existing launch at its Collections location and preserves missing-launch errors', () => {
vi.mocked(getCollection).mockReturnValue({ collection: { id: 'launch-123' } } as ReturnType<typeof getCollection>);
vi.mocked(getCollection).mockReturnValue({ collection: { id: 'launch-123' } } as ReturnType<
typeof getCollection
>);
expect(collectionLoad({ params: { id: 'launch-123' } })).toEqual({});
expect(getCollection).toHaveBeenCalledWith('launch-123');
vi.mocked(getCollection).mockReturnValue(null);
expect(() => collectionLoad({ params: { id: 'missing' } })).toThrow(expect.objectContaining({ status: 404, body: { message: 'Collection not found.' } }));
expect(() => collectionLoad({ params: { id: 'missing' } })).toThrow(
expect.objectContaining({ status: 404, body: { message: 'Collection not found.' } })
);
});
it('redirects Provisioning collection bookmarks with the same ID and query parameters', () => {
expect(() => provisioningCollectionLoad({
params: { id: 'launch-123' },
url: new URL('http://localhost/provisioning/collections/launch-123?view=history&limit=50')
})).toThrow(expect.objectContaining({ status: 308, location: '/collections/launches/launch-123?view=history&limit=50' }));
expect(() =>
provisioningCollectionLoad({
params: { id: 'launch-123' },
url: new URL(
'http://localhost/provisioning/collections/launch-123?view=history&limit=50'
)
})
).toThrow(
expect.objectContaining({
status: 308,
location: '/collections/launches/launch-123?view=history&limit=50'
})
);
expect(getCollection).not.toHaveBeenCalled();
});
it.each([
['/deployments/collections/launch-123?limit=50&from=old%20link', '/collections/launches/launch-123?limit=50&from=old%20link'],
['/deployments/operation-123?from=collection', '/provisioning/operation-123?from=collection'],
[
'/deployments/collections/launch-123?limit=50&from=old%20link',
'/collections/launches/launch-123?limit=50&from=old%20link'
],
[
'/deployments/operation-123?from=collection',
'/provisioning/operation-123?from=collection'
],
['/deployments?action=create&limit=50', '/provisioning?action=create&limit=50']
])('keeps legacy %s bookmarks compatible', (path, location) => {
expect(() => deploymentsLoad({ url: new URL(path, 'http://localhost') })).toThrow(expect.objectContaining({ status: 308, location }));
expect(() => deploymentsLoad({ url: new URL(path, 'http://localhost') })).toThrow(
expect.objectContaining({ status: 308, location })
);
});
});