chore: guard backend responsibility boundaries
This commit is contained in:
@@ -91,6 +91,36 @@ test('numeric literals require names, including previously ignored numbers and b
|
||||
}
|
||||
});
|
||||
|
||||
test('architecture imports enforce direct boundaries without banning DTOs or pure protocol inputs', async () => {
|
||||
const domain = 'src/modules/banking/bank-cards/domain/rub-money.ts';
|
||||
const controller = 'src/modules/auth/presentation/auth.controller.ts';
|
||||
const useCase = 'src/modules/banking/bank-cards/application/get-bank-summary.use-case.ts';
|
||||
for (const [filePath, code] of [
|
||||
[domain, 'import { Injectable } from "@nestjs/common";'],
|
||||
[domain, 'import { MoneyDto } from "../../../../common/money.dto";'],
|
||||
[domain, 'import { PrismaService } from "../../../../prisma/prisma.service";'],
|
||||
[controller, 'import { PrismaService } from "../../../prisma/prisma.service";'],
|
||||
[controller, 'import { TbankClient } from "../../../integrations/tbank/tbank.api";'],
|
||||
[useCase, 'import { PrismaService } from "../../../../prisma/prisma.service";'],
|
||||
]) {
|
||||
const [result] = await eslint.lintText(code, { filePath });
|
||||
assert.equal(result.fatalErrorCount, 0);
|
||||
assert.ok(result.messages.some(({ ruleId }) => ruleId === 'no-restricted-imports'), code);
|
||||
}
|
||||
for (const [filePath, code] of [
|
||||
[domain, 'import type { Money } from "../../../../common/money.types";'],
|
||||
[domain, 'import { TbankOperationState } from "../../../../integrations/tbank/tbank-protocol";'],
|
||||
[controller, 'import { AuthService } from "../application/auth.service";'],
|
||||
[useCase, 'import { BankCardsRepository } from "../infrastructure/bank-cards.repository";'],
|
||||
[useCase, 'import { BankSummaryQueryDto } from "../presentation/bank-card.dto";'],
|
||||
['src/modules/banking/bank-cards/application/bank-cards.service.ts', 'import { PrismaService } from "../../../../prisma/prisma.service";'],
|
||||
]) {
|
||||
const [result] = await eslint.lintText(code, { filePath });
|
||||
assert.equal(result.fatalErrorCount, 0);
|
||||
assert.ok(result.messages.every(({ ruleId }) => ruleId !== 'no-restricted-imports'), code);
|
||||
}
|
||||
});
|
||||
|
||||
// Single-use codes must be caught too; fixture literals remain independent wire assertions.
|
||||
test('machine codes require enum members without banning ordinary text or Prisma selects', async () => {
|
||||
const eslint = new ESLint();
|
||||
|
||||
Reference in New Issue
Block a user