Fix boolean logic (#129)

This commit is contained in:
Benoit Dion 2020-08-10 10:30:06 -04:00 committed by GitHub
parent e003f9e2ca
commit 1f8d196ed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 13 deletions

View File

@ -64,7 +64,7 @@ inputs:
description: 'The android versionCode'
androidAppBundle:
required: false
default: false
default: 'false'
description: 'Whether to build .aab instead of .apk'
androidKeystoreName:
required: false

File diff suppressed because one or more lines are too long

View File

@ -46,9 +46,9 @@ class Input {
}
static get androidAppBundle() {
const input = core.getInput('androidAppBundle') || 'false';
const input = core.getInput('androidAppBundle') || false;
return input === 'true' ? 'true' : 'false';
return input === 'true';
}
static get androidKeystoreName() {
@ -72,9 +72,9 @@ class Input {
}
static get allowDirtyBuild() {
const input = core.getInput('allowDirtyBuild') || 'false';
const input = core.getInput('allowDirtyBuild') || false;
return input === 'true' ? 'true' : 'false';
return input === 'true';
}
static get customParameters() {

View File

@ -133,18 +133,18 @@ describe('Input', () => {
describe('androidAppBundle', () => {
it('returns the default value', () => {
expect(Input.androidAppBundle).toStrictEqual('false');
expect(Input.androidAppBundle).toStrictEqual(false);
});
it('returns true when string true is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
expect(Input.androidAppBundle).toStrictEqual('true');
expect(Input.androidAppBundle).toStrictEqual(true);
expect(spy).toHaveBeenCalledTimes(1);
});
it('returns false when string false is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
expect(Input.androidAppBundle).toStrictEqual('false');
expect(Input.androidAppBundle).toStrictEqual(false);
expect(spy).toHaveBeenCalledTimes(1);
});
});
@ -216,18 +216,18 @@ describe('Input', () => {
describe('allowDirtyBuild', () => {
it('returns the default value', () => {
expect(Input.allowDirtyBuild).toStrictEqual('false');
expect(Input.allowDirtyBuild).toStrictEqual(false);
});
it('returns true when string true is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
expect(Input.allowDirtyBuild).toStrictEqual('true');
expect(Input.allowDirtyBuild).toStrictEqual(true);
expect(spy).toHaveBeenCalledTimes(1);
});
it('returns false when string false is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
expect(Input.allowDirtyBuild).toStrictEqual('false');
expect(Input.allowDirtyBuild).toStrictEqual(false);
expect(spy).toHaveBeenCalledTimes(1);
});
});

View File

@ -10,7 +10,7 @@ export default class Versioning {
}
static get isDirtyAllowed() {
return Input.allowDirtyBuild === 'true';
return Input.allowDirtyBuild;
}
static get strategies() {