Skip to content

Commit

Permalink
refactor: replace getEmployee function for tests to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
akovylyaeva committed Jun 28, 2024
1 parent 5dd1f5b commit 9a906bd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,7 @@ import AccessBasedOnPermissionsState from '../../../../../routes/state/AccessBas
import AccessBasedOnPermissionsStateContext from '../../../../../routes/state/AccessBasedOnPermissionsStateContext';
import { Employee } from '../../../types';
import { EmployeeItem } from './EmployeeItem';

function getEmployee({ ...props }: Partial<Employee>) {
return {
employeeId: 1,
fullName: 'name',
corporateEmail: 'email',
personalEmail: 'personal email',
phone: '79111111111',
gitHub: 'github',
gitLab: 'gitlab',
netSalary: 100,
ratePerHour: 101,
fullSalary: 102,
employmentType: 0.5,
parking: 103,
personnelNumber: '11/23',
hireDate: '11.11.23',
isCurrentEmployee: true,
isBlankEmployee: false,
...props,
};
}
import { getEmployee } from '../../../utils/utilsForTests';

describe('EmployeeItem', () => {
it(`
Expand Down
2 changes: 1 addition & 1 deletion src/features/employees/state/EmployeesState.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getEmployee } from '../components/EmployeeList/components/EmployeeItem.cy';
import { getEmployee } from '../utils/utilsForTests';
import EmployeesState from './EmployeesState';

const employeesState = new EmployeesState();
Expand Down
23 changes: 23 additions & 0 deletions src/features/employees/utils/utilsForTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Employee } from '../types';

export function getEmployee({ ...props }: Partial<Employee>) {
return {
employeeId: 1,
fullName: 'name',
corporateEmail: 'email',
personalEmail: 'personal email',
phone: '79111111111',
gitHub: 'github',
gitLab: 'gitlab',
netSalary: 100,
ratePerHour: 101,
fullSalary: 102,
employmentType: 0.5,
parking: 103,
personnelNumber: '11/23',
hireDate: '11.11.23',
isCurrentEmployee: true,
isBlankEmployee: false,
...props,
};
}

0 comments on commit 9a906bd

Please sign in to comment.