chore: strengthen backend eslint profile
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
import type { Server } from 'node:http';
|
||||
|
||||
import { INestApplication, NotFoundException } from '@nestjs/common';
|
||||
import { JwtService } from '@nestjs/jwt';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import type { Server } from 'node:http';
|
||||
import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../src/app.module';
|
||||
import { TbankAccessService } from '../src/integrations/tbank/tbank-access.service';
|
||||
import { TbankTokenService } from '../src/integrations/tbank/tbank-token.service';
|
||||
import { TbankClient } from '../src/integrations/tbank/tbank.client';
|
||||
import { configureApp } from '../src/main';
|
||||
import { PrismaService } from '../src/prisma/prisma.service';
|
||||
import { TbankClient } from '../src/integrations/tbank/tbank.client';
|
||||
import { TbankTokenService } from '../src/integrations/tbank/tbank-token.service';
|
||||
import { TbankAccessService } from '../src/integrations/tbank/tbank-access.service';
|
||||
|
||||
describe('Persistent T-Bank connection boundary (SQLite/HTTP)', () => {
|
||||
let app: INestApplication<Server>;
|
||||
@@ -35,10 +37,11 @@ describe('Persistent T-Bank connection boundary (SQLite/HTTP)', () => {
|
||||
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();
|
||||
@@ -57,7 +60,7 @@ describe('Persistent T-Bank connection boundary (SQLite/HTTP)', () => {
|
||||
.expect(401);
|
||||
expect(upstream.validateToken).not.toHaveBeenCalled();
|
||||
const response = await put(' synthetic-token ').expect(200);
|
||||
expect(Object.keys(response.body as object).sort()).toEqual([
|
||||
expect(Object.keys(response.body as object).sort((a, b) => a.localeCompare(b))).toEqual([
|
||||
'connected',
|
||||
'connectedAt',
|
||||
]);
|
||||
@@ -145,11 +148,12 @@ describe('Persistent T-Bank connection boundary (SQLite/HTTP)', () => {
|
||||
await expect(
|
||||
prisma.tbankOperation.create({ data: operation }),
|
||||
).rejects.toMatchObject({ code: 'P2003' });
|
||||
for (let index = 0; index < 2; index += 1)
|
||||
for (let index = 0; index < 2; index += 1) {
|
||||
await request(app.getHttpServer())
|
||||
.delete('/api/v1/tbank-connection')
|
||||
.set('Authorization', `Bearer ${jwt('owner')}`)
|
||||
.expect(204);
|
||||
}
|
||||
await expect(
|
||||
prisma.tbankOperation.create({
|
||||
data: { ...operation, revision: replacement.revision },
|
||||
|
||||
Reference in New Issue
Block a user