-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from oesukam/ft-integer-validation-164470111
#164470111 Add integer's validation
- Loading branch information
Showing
11 changed files
with
368 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const notInteger = require('../../src/messages/notIntegerMessage'); | ||
|
||
describe('not-an-integer-message', () => { | ||
test('should return The age must be an integer.', () => { | ||
expect(notInteger('age')).toBe('The age must be an integer.'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
const notNumber = require('../../src/messages/notNumberMessage'); | ||
|
||
describe('not-a-number-message', () => { | ||
test('should return The username must be a number.', () => { | ||
expect(notNumber('username')).toBe('The username must be a number.'); | ||
test('should return The age must be a number.', () => { | ||
expect(notNumber('age')).toBe('The age must be a number.'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const integer = require('../../src/validators/integer'); | ||
|
||
describe('integer-validator', () => { | ||
test('should return The undefined must be an integer.', () => { | ||
expect(integer()).toBe('The undefined must be an integer.'); | ||
}); | ||
|
||
test('should return The age must be an integer.', () => { | ||
expect(integer({ | ||
value: 'not an integer', | ||
label: 'age', | ||
}),).toBe('The age must be an integer.'); | ||
}); | ||
|
||
test('should return The age must be an integer.', () => { | ||
expect(integer({ | ||
value: '21', | ||
label: 'age', | ||
}),).toBe('The age must be an integer.'); | ||
}); | ||
|
||
test('should return The age must be an integer.', () => { | ||
expect(integer({ | ||
value: 25.5, | ||
label: 'age', | ||
}),).toBe('The age must be an integer.'); | ||
}); | ||
|
||
test('should return false', () => { | ||
expect(integer({ | ||
value: 21, | ||
label: 'age', | ||
}),).toBe(false); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.