chore: strengthen backend eslint profile
This commit is contained in:
@@ -199,8 +199,9 @@ describe('MoexClient', () => {
|
||||
const url = new URL(input instanceof Request ? input.url : input);
|
||||
if (url.searchParams.get('iss.only')?.startsWith('coupons,')) {
|
||||
starts.push(url.searchParams.get('start') ?? '');
|
||||
if (starts.length > 1)
|
||||
if (starts.length > 1) {
|
||||
return Promise.reject(new Error('Repeated page'));
|
||||
}
|
||||
}
|
||||
return Promise.resolve(
|
||||
Response.json({
|
||||
@@ -228,13 +229,14 @@ describe('MoexClient', () => {
|
||||
const start = Number(url.searchParams.get('start'));
|
||||
if (url.searchParams.get('iss.only')?.startsWith('coupons,')) {
|
||||
starts.push(String(start));
|
||||
if (starts.length > 2)
|
||||
if (starts.length > 2) {
|
||||
return Promise.reject(new Error('Repeated page'));
|
||||
}
|
||||
}
|
||||
return Promise.resolve(
|
||||
Response.json({
|
||||
...emptyEvents,
|
||||
coupons: {
|
||||
'coupons': {
|
||||
columns: ['coupondate', 'value', 'faceunit'],
|
||||
data: [[`2099-02-0${start + 1}`, '2.000000001', 'SUR']],
|
||||
},
|
||||
@@ -246,11 +248,13 @@ describe('MoexClient', () => {
|
||||
);
|
||||
});
|
||||
const result = new MoexClient().bondEvents('BOND');
|
||||
if (repeatIndex)
|
||||
if (repeatIndex) {
|
||||
// eslint-disable-next-line jest/no-conditional-expect -- The parameterized fixture chooses the scenario; each branch asserts its outcome and the test also asserts common invariants.
|
||||
await expect(result).rejects.toMatchObject({
|
||||
response: { code: 'MOEX_UNAVAILABLE' },
|
||||
});
|
||||
else
|
||||
} else {
|
||||
// eslint-disable-next-line jest/no-conditional-expect -- The parameterized fixture chooses the scenario; each branch asserts its outcome and the test also asserts common invariants.
|
||||
await expect(result).resolves.toEqual([
|
||||
{
|
||||
type: 'coupon',
|
||||
@@ -265,6 +269,7 @@ describe('MoexClient', () => {
|
||||
currency: 'RUB',
|
||||
},
|
||||
]);
|
||||
}
|
||||
expect(starts).toEqual(['0', '1']);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user