Use boolean

This commit is contained in:
Toby Harris 2023-09-20 13:05:15 +01:00
parent 3e4f343b07
commit aab7c4f710
6 changed files with 16 additions and 9 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -119,7 +119,7 @@ echo ""
unity-editor \
-logfile /dev/stdout \
$( [ -n "${MANUAL_EXIT+set}" ] || echo "-quit" ) \
$( [ "${MANUAL_EXIT}" == "true" ] || echo "-quit" ) \
-customBuildName "$BUILD_NAME" \
-projectPath "$UNITY_PROJECT_PATH" \
-buildTarget "$BUILD_TARGET" \

View File

@ -29,7 +29,7 @@ class BuildParameters {
public buildFile!: string;
public buildMethod!: string;
public buildVersion!: string;
public manualExit!: string | undefined;
public manualExit!: boolean;
public androidVersionCode!: string;
public androidKeystoreName!: string;
public androidKeystoreBase64!: string;

View File

@ -106,13 +106,18 @@ describe('Input', () => {
describe('manualExit', () => {
it('returns the default value', () => {
expect(Input.manualExit).toStrictEqual(undefined);
expect(Input.manualExit).toStrictEqual(false);
});
it('takes input from the users workflow', () => {
const mockValue = 'x';
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue);
expect(Input.manualExit).toStrictEqual(mockValue);
it('returns true when string true is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
expect(Input.manualExit).toStrictEqual(true);
expect(spy).toHaveBeenCalledTimes(1);
});
it('returns false when string false is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
expect(Input.manualExit).toStrictEqual(false);
expect(spy).toHaveBeenCalledTimes(1);
});
});

View File

@ -126,8 +126,10 @@ class Input {
return Input.getInput('buildMethod') || ''; // Processed in docker file
}
static get manualExit(): string | undefined {
return Input.getInput('manualExit');
static get manualExit(): boolean {
const input = Input.getInput('manualExit') || false;
return input === 'true';
}
static get customParameters(): string {