test-infra: re-enable 16 disabled server suites (jest DI + lib0 ESM) (#56)

16 suites were disabled via testPathIgnorePatterns due to two root causes: lib0
ESM not transformed (the @hocuspocus/server -> lib0/decoding.js chain) and stock
'should be defined' specs built via Test.createTestingModule without providers.
Add lib0 to transformIgnorePatterns; convert the 14 DI placeholders to direct
new X(...) instantiation with stub deps (keeping a real construct smoke test);
re-enable the suites. Also updates the public-share limiter test to assert the
fail-closed behavior from #62 (surfaced now that the suite runs). Full server
suite: 67 passed, 689 tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
claude code agent 227
2026-06-21 03:40:40 +03:00
parent 8016b1c540
commit c486750b2a
16 changed files with 174 additions and 130 deletions
@@ -1,17 +1,15 @@
import { Test, TestingModule } from '@nestjs/testing';
import { GroupController } from './group.controller';
import { GroupService } from './services/group.service';
// Direct instantiation with stub deps, mirroring the rest of these unit specs.
describe('GroupController', () => {
let controller: GroupController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [GroupController],
providers: [GroupService],
}).compile();
controller = module.get<GroupController>(GroupController);
beforeEach(() => {
controller = new GroupController(
{} as any, // groupService
{} as any, // groupUserService
{} as any, // workspaceAbility
);
});
it('should be defined', () => {
@@ -1,15 +1,22 @@
import { Test, TestingModule } from '@nestjs/testing';
import { GroupService } from './group.service';
// Direct instantiation with stub deps. The Test.createTestingModule form failed
// to resolve the @InjectKysely() connection token (and AUDIT_SERVICE) at
// compile(); this smoke test only needs the service to construct.
describe('GroupService', () => {
let service: GroupService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [GroupService],
}).compile();
service = module.get<GroupService>(GroupService);
beforeEach(() => {
service = new GroupService(
{} as any, // groupRepo
{} as any, // groupUserRepo
{} as any, // spaceMemberRepo
{} as any, // groupUserService
{} as any, // watcherRepo
{} as any, // favoriteRepo
{} as any, // db
{} as any, // auditService
);
});
it('should be defined', () => {