chore: strengthen backend eslint profile
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
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 { InstrumentMetadataService } from '../src/integrations/tbank/instrument-metadata.service';
|
||||
|
||||
import type { TbankInstrument } from '../src/integrations/tbank/tbank.client';
|
||||
|
||||
import {
|
||||
InstrumentMetadataRepository,
|
||||
metadataKey,
|
||||
} from '../src/integrations/tbank/instrument-metadata.repository';
|
||||
import type { TbankInstrument } from '../src/integrations/tbank/tbank.client';
|
||||
import { InstrumentMetadataService } from '../src/integrations/tbank/instrument-metadata.service';
|
||||
import { TbankAccessService } from '../src/integrations/tbank/tbank-access.service';
|
||||
import { TbankTokenService } from '../src/integrations/tbank/tbank-token.service';
|
||||
import { PrismaService } from '../src/prisma/prisma.service';
|
||||
|
||||
// Shared publication is proven against real FK/transaction/connection boundaries.
|
||||
describe('durable shared instrument metadata (SQLite)', () => {
|
||||
@@ -55,18 +57,20 @@ describe('durable shared instrument metadata (SQLite)', () => {
|
||||
});
|
||||
async function settled() {
|
||||
for (let index = 0; index < 300; index++) {
|
||||
if (!(await prisma.tbankSyncWork.count({ where: { state: 'running' } })))
|
||||
if (!(await prisma.tbankSyncWork.count({ where: { state: 'running' } }))) {
|
||||
return;
|
||||
}
|
||||
await delay(5);
|
||||
}
|
||||
throw new Error('Metadata 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 () => {
|
||||
@@ -152,7 +156,7 @@ describe('durable shared instrument metadata (SQLite)', () => {
|
||||
await delay(10);
|
||||
await service.read('other', identity);
|
||||
await prisma.tbankConnection.delete({ where: { userId: 'owner' } });
|
||||
if (action === 'replace')
|
||||
if (action === 'replace') {
|
||||
await prisma.tbankConnection.create({
|
||||
data: {
|
||||
userId: 'owner',
|
||||
@@ -161,6 +165,7 @@ describe('durable shared instrument metadata (SQLite)', () => {
|
||||
connectedAt: new Date(),
|
||||
},
|
||||
});
|
||||
}
|
||||
blocked.resolve(known);
|
||||
await settled();
|
||||
expect(await prisma.tbankInstrument.count()).toBe(0);
|
||||
@@ -346,9 +351,9 @@ describe('durable shared instrument metadata (SQLite)', () => {
|
||||
await service.read('owner', identity);
|
||||
await settled();
|
||||
const identities = Array.from({ length: 1000 }, (_, index) =>
|
||||
index
|
||||
? { instrumentUid: `uid-${index}`, figi: `FIGI-${index}` }
|
||||
: identity,
|
||||
index ?
|
||||
{ instrumentUid: `uid-${index}`, figi: `FIGI-${index}` } :
|
||||
identity,
|
||||
);
|
||||
const saved = await service.savedMany(identities);
|
||||
expect(saved.size).toBe(1000);
|
||||
|
||||
Reference in New Issue
Block a user