45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
||
import type { IVersionCard } from '../../types/consolidations/version_members';
|
||
import { normalizeData } from './normalize';
|
||
|
||
const card = {
|
||
id: 'v1',
|
||
members: [
|
||
{
|
||
id: 'le1',
|
||
name: 'АО "Русский бисквит"',
|
||
inn: '3528052718',
|
||
is_head_entity: true,
|
||
entity_type: 'ЮЛ',
|
||
osv_accounts: ['62', '60'],
|
||
checklist: [
|
||
{ document_type: 'BALANCE', account: null, status: 'NEEDS_CHECK', missing_quarters: [], document_ids: ['d1'] },
|
||
{ document_type: 'INCOME', account: null, status: 'MISSING', missing_quarters: [], document_ids: [] },
|
||
{ document_type: 'OSV', account: '62', status: 'CONFIRMED', missing_quarters: [], document_ids: ['d2'] },
|
||
{ document_type: 'OSV', account: '60', status: 'PROCESSING', missing_quarters: [], document_ids: [] },
|
||
{ document_type: 'OSV', account: '58', status: 'MISSING', missing_quarters: ['Q1'], document_ids: [] },
|
||
],
|
||
},
|
||
],
|
||
} as unknown as IVersionCard;
|
||
|
||
describe('normalizeData', () => {
|
||
it('строка ЮЛ со статусами ББ/ОФР и загруженными ОСВ', () => {
|
||
expect(normalizeData(card)).toEqual([
|
||
{
|
||
id: 'le1',
|
||
name: 'АО "Русский бисквит"',
|
||
inn: '3528052718',
|
||
version_id: 'v1',
|
||
entity_type: 'ЮЛ',
|
||
bb_status: 'Требуется проверка',
|
||
ofr_status: 'Отсутствует',
|
||
uploaded_osvs: '60, 62',
|
||
},
|
||
]);
|
||
});
|
||
it('null — пусто', () => {
|
||
expect(normalizeData(null)).toEqual([]);
|
||
});
|
||
});
|