chore: strengthen backend eslint profile

This commit is contained in:
2026-09-28 11:04:18 +03:00
parent ca5dbcb382
commit 9b3558f96c
179 changed files with 4485 additions and 2716 deletions
+9 -5
View File
@@ -1,7 +1,7 @@
import assert from 'node:assert/strict';
import { ConfigService } from '@nestjs/config';
import assert from 'node:assert/strict';
import { setTimeout as delay } from 'node:timers/promises';
import { PrismaService } from '../src/prisma/prisma.service';
import { TbankAccessService } from '../src/integrations/tbank/tbank-access.service';
import { TbankTokenService } from '../src/integrations/tbank/tbank-token.service';
import { CatalogDiscoveryService } from '../src/modules/investments/instruments/application/catalog-discovery.service';
@@ -10,6 +10,7 @@ import {
type CatalogInstrument,
type CatalogQuery,
} from '../src/modules/investments/instruments/infrastructure/catalog-discovery.repository';
import { PrismaService } from '../src/prisma/prisma.service';
// Real transactions prove query coverage, private work ownership and late-publication fences.
describe('shared catalog discovery (SQLite)', () => {
@@ -52,18 +53,20 @@ describe('shared catalog discovery (SQLite)', () => {
});
async function settled() {
for (let i = 0; i < 300; i++) {
if (!(await prisma.tbankSyncWork.count({ where: { state: 'running' } })))
if (!(await prisma.tbankSyncWork.count({ where: { state: 'running' } }))) {
return;
}
await delay(5);
}
throw new Error('Catalog work did not settle');
}
beforeAll(async () => {
await prisma.$connect();
for (const id of ['owner', 'other'])
for (const id of ['owner', 'other']) {
await prisma.user.create({
data: { id, email: `${id}@example.invalid`, passwordHash: 'synthetic' },
});
}
});
afterAll(async () => prisma.$disconnect());
beforeEach(async () => {
@@ -199,7 +202,7 @@ describe('shared catalog discovery (SQLite)', () => {
await service.read('other', query);
await delay(10);
await prisma.tbankConnection.delete({ where: { userId: 'owner' } });
if (action === 'replace')
if (action === 'replace') {
await prisma.tbankConnection.create({
data: {
userId: 'owner',
@@ -208,6 +211,7 @@ describe('shared catalog discovery (SQLite)', () => {
connectedAt: new Date(),
},
});
}
blocked.resolve([instrument]);
await settled();
expect(await prisma.tbankCatalogDiscovery.count()).toBe(0);