Skip to content

Commit

Permalink
test: improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
alisher-epam committed Jan 16, 2024
1 parent 20c7b31 commit d6ba390
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
validatePeriod,
} from './utils';

jest.mock('./utils', () => ({
...jest.requireActual('./utils'),
validateRequiredMinAndMaxNumber: jest.fn(),
jest.mock('@folio/stripes-acq-components', () => ({
...jest.requireActual('@folio/stripes-acq-components'),
validateRequiredMinNumber: jest.fn(({ minNumber, value }) => (minNumber <= value ? undefined : 'min error')),
validateRequiredMaxNumber: jest.fn(({ maxNumber, value }) => (maxNumber >= value ? undefined : 'max error')),
}));

describe('OrganizationIntegrationForm utils', () => {
Expand Down Expand Up @@ -37,11 +38,12 @@ describe('OrganizationIntegrationForm utils', () => {

describe('validateRequiredMinAndMaxNumber', () => {
it('should return undefined', () => {
expect(validateRequiredMinAndMaxNumber({
minNumber: 0,
maxNumber: 1,
value: 0,
})).toBe(undefined);
expect(validateRequiredMinAndMaxNumber(0)).toBeTruthy();
expect(validateRequiredMinAndMaxNumber('')).toBeTruthy();
expect(validateRequiredMinAndMaxNumber(-1)).toBeTruthy();
expect(validateRequiredMinAndMaxNumber(1)).toBe(undefined);
expect(validateRequiredMinAndMaxNumber(2)).toBe(undefined);
expect(validateRequiredMinAndMaxNumber(34)).toBeTruthy();
});
});
});

0 comments on commit d6ba390

Please sign in to comment.