Add failing test for port coercion

This commit is contained in:
Taras Mankovski
2020-09-03 07:55:32 -04:00
parent b77a1d6bcb
commit 7219d18853
+29
View File
@@ -30,6 +30,14 @@ jest.mock('fs-extra', () => {
sessionKey: development-key
`,
'/root/secrets/session-key.txt': 'abc123',
'/secret-port/app-config.yaml': `
backend:
listen:
port:
$secret:
file: secrets/port.txt
`,
'/secret-port/secrets/port.txt': '12345',
};
return {
@@ -137,4 +145,25 @@ describe('loadConfig', () => {
},
]);
});
it('coerces port to a number', async () => {
await expect(
loadConfig({
rootPaths: ['/secret-port'],
env: 'production',
shouldReadSecrets: true,
}),
).resolves.toEqual([
{
context: 'app-config.yaml',
data: {
backend: {
listen: {
port: 12345,
},
},
},
},
]);
});
});