mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
fix(test): repair the escaped newlines and wire the new controller arg
The stderr and --version fixtures had literal line breaks in them, and the admin controller helper still built the controller with eight arguments.
This commit is contained in:
@@ -10,6 +10,7 @@ import { AdminController } from '../../../src/nest/admin/admin.controller';
|
||||
import type { TokenService } from '../../../src/nest/tokens/token.service';
|
||||
import type { RegistrationInvitesService } from '../../../src/nest/auth/registration-invites.service';
|
||||
import type { OauthService } from '../../../src/nest/oauth/oauth.service';
|
||||
import { KitineraryExtractorService } from '../../../src/nest/booking-import/kitinerary-extractor.service';
|
||||
import type { AdminService } from '../../../src/nest/admin/admin.service';
|
||||
import type { PluginRuntimeService } from '../../../src/nest/plugins/plugin-runtime.service';
|
||||
import type { AuditService } from '../../../src/nest/audit/audit.service';
|
||||
@@ -50,8 +51,18 @@ const addonsStub = () => ({
|
||||
|
||||
// The MCP-token routes read TokenService now, not AdminService. Stubbed via a
|
||||
// fourth, optional argument so every existing call site stays as it was.
|
||||
const adminCtl = (s: AdminService, rt?: PluginRuntimeService, addons: AddonsService = addonsStub(), tokens: Partial<TokenService> = {}, invites: Partial<RegistrationInvitesService> = {}, oauth: Partial<OauthService> = {}) =>
|
||||
new AdminController(s, addons, rt as unknown as PluginRuntimeService, audit, notifications, tokens as TokenService, invites as RegistrationInvitesService, oauth as OauthService);
|
||||
const adminCtl = (s: AdminService, rt?: PluginRuntimeService, addons: AddonsService = addonsStub(), tokens: Partial<TokenService> = {}, invites: Partial<RegistrationInvitesService> = {}, oauth: Partial<OauthService> = {}, kitinerary: Partial<KitineraryExtractorService> = {}) =>
|
||||
new AdminController(s, addons, rt as unknown as PluginRuntimeService, audit, notifications, tokens as TokenService, invites as RegistrationInvitesService, oauth as OauthService, kitinerary as KitineraryExtractorService);
|
||||
// #2261 — the extractor's version is what tells a stale binary from a provider
|
||||
// nobody wrote a script for; both come back empty otherwise.
|
||||
describe('AdminController system-info', () => {
|
||||
it('ADM-SYSINFO-001: hands the extractor description through unchanged', () => {
|
||||
const describeFn = vi.fn(() => ({ available: true, path: '/usr/local/bin/kitinerary-extractor', version: '6.3.3', configuredPath: null }));
|
||||
const res = adminCtl({} as AdminService, undefined, addonsStub(), {}, {}, {}, { describe: describeFn }).systemInfo();
|
||||
expect(res).toEqual({ kitinerary: { available: true, path: '/usr/local/bin/kitinerary-extractor', version: '6.3.3', configuredPath: null } });
|
||||
});
|
||||
});
|
||||
|
||||
function thrown(fn: () => unknown): { status: number; body: unknown } {
|
||||
try { fn(); } catch (err) {
|
||||
if (err instanceof NotFoundException) return { status: 404, body: err.getResponse() };
|
||||
|
||||
Reference in New Issue
Block a user