-
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.
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "valid-objects-ts", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"main": ".dist/index.js", | ||
"types": ".dist/index.d.ts", | ||
"repository": "[email protected]:Travelport-Czech/valid-objects-ts.git", | ||
|
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,3 @@ | ||
import { ExtendableError } from 'extendable-error' | ||
|
||
export class ValidObjectLogicError extends ExtendableError {} |
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,23 @@ | ||
import { ValidNumber } from '@/validObjects/ValidNumber' | ||
import { expect } from 'chai' | ||
|
||
describe('ValidNumber', () => { | ||
it('Construct default', () => { | ||
expect(new ValidNumber(0).value).to.equal(0) | ||
expect(new ValidNumber(1).value).to.equal(1) | ||
expect(new ValidNumber(-1).value).to.equal(-1) | ||
expect(new ValidNumber(-1000000000).value).to.equal(-1000000000) | ||
expect(new ValidNumber(1000000000).value).to.equal(1000000000) | ||
}) | ||
|
||
it('Construct with range', () => { | ||
expect(new ValidNumber(-2, -2, 2).value).to.equal(-2) | ||
expect(new ValidNumber(0, -2, 2).value).to.equal(0) | ||
expect(new ValidNumber(1, -2, 2).value).to.equal(1) | ||
expect(new ValidNumber(2, -2, 2).value).to.equal(2) | ||
|
||
expect(() => new ValidNumber(-3, -2, 2)).to.throw("Invalid number 'Number (-3) can not be smaller than -2'.") | ||
expect(() => new ValidNumber(0, 1, 2)).to.throw("Invalid number 'Number (0) can not be smaller than 1'.") | ||
expect(() => new ValidNumber(3, 1, 2)).to.throw("Invalid number 'Number (3) can not be bigger than 2'.") | ||
}) | ||
}) |
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