Skip to content

Commit 750f270

Browse files
committed
fix: make sure default version of sqlserver-version is used
1 parent 1956129 commit 750f270

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

lib/main/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface Inputs {
5656
* @returns {Inputs}
5757
*/
5858
export function gatherInputs(): Inputs {
59-
const version = core.getInput('sqlserver-version').replace(/sql-/i, '');
59+
const version = core.getInput('sqlserver-version').replace(/sql-/i, '') || 'latest';
6060
return {
6161
version: version.toLowerCase() === 'latest' ? '2022' : version,
6262
password: core.getInput('sa-password'),

test/utils.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,23 @@ describe('utils', () => {
234234
skipOsCheck: false,
235235
});
236236
});
237+
it('constructs input object with default version', () => {
238+
coreStub.getInput.withArgs('sqlserver-version').returns('');
239+
coreStub.getInput.withArgs('sa-password').returns('secret password');
240+
coreStub.getInput.withArgs('db-collation').returns('SQL_Latin1_General_CP1_CI_AS');
241+
coreStub.getMultilineInput.withArgs('install-arguments').returns([]);
242+
coreStub.getBooleanInput.withArgs('wait-for-ready').returns(true);
243+
coreStub.getBooleanInput.withArgs('skip-os-check').returns(false);
244+
const res = utils.gatherInputs();
245+
expect(res).to.deep.equal({
246+
version: '2022',
247+
password: 'secret password',
248+
collation: 'SQL_Latin1_General_CP1_CI_AS',
249+
installArgs: [],
250+
wait: true,
251+
skipOsCheck: false,
252+
});
253+
});
237254
});
238255
describe('.downloadTool()', () => {
239256
let downloadStub: SinonStubbedMember<typeof tc.downloadTool>;

0 commit comments

Comments
 (0)