Add failed test for coercion of numberic strings
This commit is contained in:
@@ -35,6 +35,7 @@ const DATA = {
|
||||
strings: ['string1', 'string2'],
|
||||
},
|
||||
nestlings: [{ boolean: true }, { string: 'string' }, { number: 42 }] as {}[],
|
||||
port: 'number',
|
||||
};
|
||||
|
||||
function expectValidValues(config: ConfigReader) {
|
||||
@@ -580,4 +581,17 @@ describe('ConfigReader.get()', () => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('coerces number strings to numbers', () => {
|
||||
const config = ConfigReader.fromConfigs([
|
||||
{
|
||||
data: {
|
||||
port: '123',
|
||||
},
|
||||
context: '1',
|
||||
},
|
||||
]);
|
||||
|
||||
expect(config.getNumber('port')).toEqual(123);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user