-
Notifications
You must be signed in to change notification settings - Fork 0
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 #9 from JuanMaRuiz/feature/convert-to-esm
(feature): convert to esm module
- Loading branch information
Showing
10 changed files
with
3,815 additions
and
206 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
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
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,27 +1,27 @@ | ||
const validator = require('./../src/validator'); | ||
import validate from './../src/validator.js'; | ||
|
||
// Valid ISBN 8497364678, 84-481-2231-3, 978-84-415-2682-2 | ||
|
||
test('validator should return TRUE if passed value is a valid 10 numbers ISBN ', () => { | ||
expect(validator('84 - 481 - 2231 - 3')).toBe(true); | ||
expect(validator('84 - 481 2231- 3')).toBe(true); | ||
expect(validator('84 481 2231 3')).toBe(true); | ||
expect(validator('8448122313')).toBe(true); | ||
expect(validator('84-481-2231-3')).toBe(true); | ||
expect(validator('006095485X')).toBe(true); | ||
test('validate method should return TRUE if passed value is a valid 10 numbers ISBN ', () => { | ||
expect(validate('84 - 481 - 2231 - 3')).toBe(true); | ||
expect(validate('84 - 481 2231- 3')).toBe(true); | ||
expect(validate('84 481 2231 3')).toBe(true); | ||
expect(validate('8448122313')).toBe(true); | ||
expect(validate('84-481-2231-3')).toBe(true); | ||
expect(validate('006095485X')).toBe(true); | ||
}); | ||
|
||
test('should return FALSE if passed string does not have the correct lenght', () => { | ||
expect(validator('84 - 481 - 2231')).toBe(false); | ||
expect(validator('848122313')).toBe(false); | ||
expect(validator('isbn: 84-481-2231-3')).toBe(false); | ||
test('validate method should return FALSE if passed string does not have the correct lenght', () => { | ||
expect(validate('84 - 481 - 2231')).toBe(false); | ||
expect(validate('848122313')).toBe(false); | ||
expect(validate('isbn: 84-481-2231-3')).toBe(false); | ||
}); | ||
|
||
test('validator should return TRUE if passed value is a valid 13 numbers ISBN ', () => { | ||
expect(validator('978-84-415-2682-2')).toBe(true); | ||
expect(validator('978-34-2628-155-0')).toBe(true); | ||
test('validate method should return TRUE if passed value is a valid 13 numbers ISBN ', () => { | ||
expect(validate('978-84-415-2682-2')).toBe(true); | ||
expect(validate('978-34-2628-155-0')).toBe(true); | ||
}); | ||
|
||
test('validator should return FALSE if passed value is NOT a valid 13 numbers ISBN ', () => { | ||
expect(validator('978-0-306-40615-6')).toBe(false); | ||
test('validate method should return FALSE if passed value is NOT a valid 13 numbers ISBN ', () => { | ||
expect(validate('978-0-306-40615-6')).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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env" | ||
] | ||
} |
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,4 @@ | ||
const validate = require('./src/validator.js'); | ||
const generate = require('./src/generator.js'); | ||
import validate from './src/validator.js'; | ||
import generate from './src/generator.js'; | ||
|
||
module.exports = { | ||
validate, | ||
generate | ||
}; | ||
export { validate, generate }; |
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.