mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-19 13:36:48 +00:00
724c88c201
A mechanical prettier --write over server/src, server/tests, server/scripts and shared/src with the workspaces' .prettierrc; nothing but layout and import order changes, and every file keeps the same set of imports. shared is formatted throughout and its format baseline is empty. The server baseline keeps the 35 files that Prettier would grow past their lint:size limit (they need a split first, which is not a formatting change), and the generated entity files stay as their generator writes them.
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
import { AddonsController } from '../../../src/nest/addons/addons.controller';
|
|
import type { AddonsService } from '../../../src/nest/addons/addons.service';
|
|
|
|
import { describe, it, expect, vi } from 'vitest';
|
|
|
|
function makeService(overrides: Partial<AddonsService> = {}): AddonsService {
|
|
return {
|
|
list: vi.fn().mockReturnValue({ collabFeatures: {}, bagTracking: false, addons: [] }),
|
|
...overrides,
|
|
} as unknown as AddonsService;
|
|
}
|
|
|
|
describe('AddonsController (parity with the legacy GET /api/addons route)', () => {
|
|
it('GET / delegates straight to the service and returns its feed', async () => {
|
|
const feed = {
|
|
collabFeatures: { comments: true },
|
|
bagTracking: true,
|
|
addons: [{ id: 'atlas', name: 'Atlas', type: 'page', icon: 'globe', enabled: true }],
|
|
};
|
|
const list = vi.fn().mockReturnValue(feed);
|
|
const svc = makeService({ list } as Partial<AddonsService>);
|
|
|
|
expect(await new AddonsController(svc).list()).toBe(feed);
|
|
expect(list).toHaveBeenCalledTimes(1);
|
|
expect(list).toHaveBeenCalledWith();
|
|
});
|
|
});
|