Add Prettier and ESLint tooling (Refs #77)
This commit is contained in:
@@ -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 })
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user