-
Notifications
You must be signed in to change notification settings - Fork 61
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 #629 from Travelport-Ukraine/master
1.15.0 New option for availability request
- Loading branch information
Showing
9 changed files
with
571 additions
and
368 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { AirValidationError } = require('../AirErrors'); | ||
|
||
module.exports = (params) => { | ||
const { returnFirstAvailableOnly } = params; | ||
if (returnFirstAvailableOnly !== undefined && (typeof returnFirstAvailableOnly) !== 'boolean') { | ||
throw new AirValidationError.ReturnFirstAvailableOnlyInvalid(params); | ||
} | ||
}; |
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,27 @@ | ||
const { expect } = require('chai'); | ||
const { AirValidationError } = require('../../../src/Services/Air/AirErrors'); | ||
const validate = require('../../../src/Services/Air/validators/return-first-available-only'); | ||
|
||
describe('#Air#validators#return-first-available-only', () => { | ||
it('should throw when returnFirstAvailableOnly invalid type', () => { | ||
const params = { returnFirstAvailableOnly: 'NOT_BOOLEAN' }; | ||
try { | ||
validate(params); | ||
throw new Error('PASSED'); | ||
} catch (err) { | ||
expect(err).to.be.an.instanceOf(AirValidationError.ReturnFirstAvailableOnlyInvalid); | ||
} | ||
}); | ||
it('should not throw when no returnFirstAvailableOnly provided', () => { | ||
const params = {}; | ||
validate(params); | ||
}); | ||
it('should not throw when returnFirstAvailableOnly is false', () => { | ||
const params = { returnFirstAvailableOnly: false }; | ||
validate(params); | ||
}); | ||
it('should not throw when returnFirstAvailableOnly is true', () => { | ||
const params = { returnFirstAvailableOnly: true }; | ||
validate(params); | ||
}); | ||
}); |