Feature/vacation edo signing (#23)
Tests / frontend-test (push) Successful in 1m24s

Co-authored-by: gorbenko.pavel <gorbenko.pavel@tansu.kz>
Reviewed-on: http://git.tnsu.kz/timur.gorodetskiy/request-portal/pulls/23
This commit was merged in pull request #23.
This commit is contained in:
2026-10-05 08:53:18 +00:00
parent f8ab2a1d71
commit 637e51d7f9
85 changed files with 2152 additions and 171 deletions
@@ -0,0 +1,28 @@
import { IEmployeeOrganization } from './models/IEmployeeOrganization';
import { formatEmployeeOrganizationsWithDepartment, parseOrganizationLine } from './organizationLines';
const rec = (p: Partial<IEmployeeOrganization>): IEmployeeOrganization => ({
id: '', fio: '', email: '', iin: '', company: 'ТОО А', companyId: '', section: '', departmentId: '', position: '', mobile: '', ...p
});
describe('организации с подразделением', () => {
it('на каждую организацию своё подразделение', () => {
const text = formatEmployeeOrganizationsWithDepartment([
rec({ company: 'ТОО А', position: 'Директор', section: 'Дирекция' }),
rec({ company: 'ТОО Б', position: 'Казначей', section: 'Финансы' })
]);
expect(text.split('\n').map(parseOrganizationLine)).toEqual([
{ company: 'ТОО А', position: 'Директор', department: 'Дирекция' },
{ company: 'ТОО Б', position: 'Казначей', department: 'Финансы' }
]);
});
it('без подразделения формат прежний «Компания — должность»', () => {
expect(formatEmployeeOrganizationsWithDepartment([rec({ position: 'Директор' })])).toBe('ТОО А — Директор');
});
it('старые строки разбираются с пустым подразделением', () => {
expect(parseOrganizationLine('ТОО А — Директор')).toEqual({ company: 'ТОО А', position: 'Директор', department: '' });
expect(parseOrganizationLine('ТОО А')).toEqual({ company: 'ТОО А', position: '', department: '' });
});
});