chore: strengthen backend eslint profile
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
import type { Server } from 'node:http';
|
||||
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { setTimeout as delay } from 'node:timers/promises';
|
||||
import type { Server } from 'node:http';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { configureApp } from '../src/main';
|
||||
import { PrismaService } from '../src/prisma/prisma.service';
|
||||
import { TbankTokenService } from '../src/integrations/tbank/tbank-token.service';
|
||||
import {
|
||||
TbankClient,
|
||||
type TbankAccount,
|
||||
TbankClient,
|
||||
type TbankPortfolio,
|
||||
} from '../src/integrations/tbank/tbank.client';
|
||||
import { TbankTokenService } from '../src/integrations/tbank/tbank-token.service';
|
||||
import { PortfolioResourceDto } from '../src/modules/investments/portfolio/presentation/portfolio.dto';
|
||||
import { configureApp } from '../src/main';
|
||||
import { BrokerageAccountsResourceDto } from '../src/modules/investments/brokerage-accounts/brokerage-account.dto';
|
||||
import { PortfolioResourceDto } from '../src/modules/investments/portfolio/presentation/portfolio.dto';
|
||||
import { PrismaService } from '../src/prisma/prisma.service';
|
||||
|
||||
function deferred<T>() {
|
||||
let resolve: (value: T) => void = () => {
|
||||
@@ -72,10 +74,11 @@ describe('local accounts and portfolio HTTP (SQLite)', () => {
|
||||
await app.init();
|
||||
await app.listen(0, '127.0.0.1');
|
||||
prisma = app.get(PrismaService);
|
||||
for (const id of ['owner', 'other'])
|
||||
for (const id of ['owner', 'other']) {
|
||||
await prisma.user.create({
|
||||
data: { id, email: `${id}@example.invalid`, passwordHash: 'synthetic' },
|
||||
});
|
||||
}
|
||||
});
|
||||
beforeEach(async () => {
|
||||
await prisma.tbankConnection.deleteMany();
|
||||
@@ -336,9 +339,9 @@ describe('local accounts and portfolio HTTP (SQLite)', () => {
|
||||
]);
|
||||
await put().expect(200);
|
||||
upstream.getPortfolio.mockImplementation((_token, id) =>
|
||||
id === 'second'
|
||||
? Promise.reject(new Error('synthetic unavailable'))
|
||||
: Promise.resolve({
|
||||
id === 'second' ?
|
||||
Promise.reject(new Error('synthetic unavailable')) :
|
||||
Promise.resolve({
|
||||
positions: [
|
||||
{
|
||||
instrumentUid: uid,
|
||||
@@ -351,8 +354,9 @@ describe('local accounts and portfolio HTTP (SQLite)', () => {
|
||||
);
|
||||
await get('brokerage-accounts').expect(200);
|
||||
for (let index = 0; index < 200; index += 1) {
|
||||
if (!(await prisma.tbankSyncWork.count({ where: { state: 'running' } })))
|
||||
if (!(await prisma.tbankSyncWork.count({ where: { state: 'running' } }))) {
|
||||
break;
|
||||
}
|
||||
await delay(5);
|
||||
}
|
||||
const summaries = (await get('brokerage-accounts?sync=observe').expect(200))
|
||||
|
||||
Reference in New Issue
Block a user