Skip to content

Commit

Permalink
UIU-1675: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
annamelnyk authored and zburke committed Jul 7, 2020
1 parent 18dfaee commit 4a9ba72
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/settings/patronBlocks/Limits/LimitsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function validation(value, min, max) {
return errorMessage;
}

if (isInteger(min) && !isInteger(value) && !Number.isNaN(value)) {
if (isInteger(min) && !isInteger(numberValue) && !Number.isNaN(numberValue)) {
return errorMessage;
}

Expand Down
23 changes: 23 additions & 0 deletions test/bigtest/tests/patron-blocks/settings-limits-form-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ describe('Patron blocks limits form', () => {
});
});

describe('set float limit value', () => {
beforeEach(async function () {
await SettingsLimitsForm.limitField(0)
.fillAndBlur(12.5);
});

it('should show error message', () => {
expect(SettingsLimitsForm.errorMessage.isPresent).to.be.true;
expect(SettingsLimitsForm.errorMessage.text).to.equal(validationMessage);
});
});

describe('set invalid limit value for fee fine limit', () => {
beforeEach(async function () {
await SettingsLimitsForm.limitField(5)
Expand All @@ -91,6 +103,17 @@ describe('Patron blocks limits form', () => {
expect(SettingsLimitsForm.errorMessage.text).to.equal(feeFineValidationMessage);
});
});

describe('set float limit value for fee fine limit', () => {
beforeEach(async function () {
await SettingsLimitsForm.limitField(5)
.fillAndBlur(12.5);
});

it('should show error message', () => {
expect(SettingsLimitsForm.errorMessage.isPresent).to.be.false;
});
});
});

describe('Visit patron blocks limits form with existed limits', () => {
Expand Down

0 comments on commit 4a9ba72

Please sign in to comment.