Add failed test for coercion of numberic strings

This commit is contained in:
Taras Mankovski
2020-09-03 08:06:08 -04:00
parent 7219d18853
commit f955f92ee6
+14
View File
@@ -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);
});
});