| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  | import * as core from '@actions/core'; | 
					
						
							| 
									
										
										
										
											2019-12-22 17:07:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  | import Input from './input'; | 
					
						
							|  |  |  | import Platform from './platform'; | 
					
						
							| 
									
										
										
										
											2020-04-26 18:22:09 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-27 23:43:15 +00:00
										 |  |  | afterEach(() => { | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |   jest.restoreAllMocks(); | 
					
						
							| 
									
										
										
										
											2020-04-26 18:22:09 +00:00
										 |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-22 17:07:55 +00:00
										 |  |  | describe('Input', () => { | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |   describe('unityVersion', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							| 
									
										
										
										
											2020-12-29 05:36:31 +00:00
										 |  |  |       expect(Input.unityVersion).toStrictEqual('auto'); | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = '2020.4.99f9'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.unityVersion).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2020-09-18 16:41:31 +00:00
										 |  |  |   describe('customImage', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.customImage).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = '2020.4.99f9'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.customImage).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   describe('targetPlatform', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.targetPlatform).toStrictEqual(Platform.default); | 
					
						
							| 
									
										
										
										
											2019-12-22 17:07:55 +00:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2020-01-27 22:03:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'Android'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.targetPlatform).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('projectPath', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.projectPath).toStrictEqual('.'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'customProjectPath'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.projectPath).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('buildName', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.buildName).toStrictEqual(Input.targetPlatform); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'Build'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.buildName).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes special characters as input', () => { | 
					
						
							|  |  |  |       const mockValue = '1ßúëld2'; | 
					
						
							|  |  |  |       jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.buildName).toStrictEqual(mockValue); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('buildsPath', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.buildsPath).toStrictEqual('build'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'customBuildsPath'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.buildsPath).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('buildMethod', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.buildMethod).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'Namespace.ClassName.Method'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.buildMethod).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('versioningStrategy', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.versioningStrategy).toStrictEqual('Semantic'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'Anything'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.versioningStrategy).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('specifiedVersion', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.specifiedVersion).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = '1.33.7'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.specifiedVersion).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-24 22:02:05 +00:00
										 |  |  |   describe('androidVersionCode', () => { | 
					
						
							|  |  |  |     it('defaults to null', () => { | 
					
						
							|  |  |  |       expect(Input.androidVersionCode).toBeFalsy(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = '42'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.androidVersionCode).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-06 01:41:21 +00:00
										 |  |  |   describe('androidAppBundle', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							| 
									
										
										
										
											2020-08-10 14:30:06 +00:00
										 |  |  |       expect(Input.androidAppBundle).toStrictEqual(false); | 
					
						
							| 
									
										
										
										
											2020-07-06 01:41:21 +00:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('returns true when string true is passed', () => { | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue('true'); | 
					
						
							| 
									
										
										
										
											2020-08-10 14:30:06 +00:00
										 |  |  |       expect(Input.androidAppBundle).toStrictEqual(true); | 
					
						
							| 
									
										
										
										
											2020-07-06 01:41:21 +00:00
										 |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('returns false when string false is passed', () => { | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue('false'); | 
					
						
							| 
									
										
										
										
											2020-08-10 14:30:06 +00:00
										 |  |  |       expect(Input.androidAppBundle).toStrictEqual(false); | 
					
						
							| 
									
										
										
										
											2020-07-06 01:41:21 +00:00
										 |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('androidKeystoreName', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.androidKeystoreName).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'keystore.keystore'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.androidKeystoreName).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('androidKeystoreBase64', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.androidKeystoreBase64).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'secret'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.androidKeystoreBase64).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('androidKeystorePass', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.androidKeystorePass).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'secret'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.androidKeystorePass).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('androidKeyaliasName', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.androidKeyaliasName).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'secret'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.androidKeyaliasName).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('androidKeyaliasPass', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.androidKeyaliasPass).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'secret'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.androidKeyaliasPass).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-11-24 12:51:52 +00:00
										 |  |  |   describe('androidTargetSdkVersion', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.androidTargetSdkVersion).toStrictEqual(''); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = 'secret'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.androidTargetSdkVersion).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |   describe('allowDirtyBuild', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							| 
									
										
										
										
											2020-08-10 14:30:06 +00:00
										 |  |  |       expect(Input.allowDirtyBuild).toStrictEqual(false); | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('returns true when string true is passed', () => { | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue('true'); | 
					
						
							| 
									
										
										
										
											2020-08-10 14:30:06 +00:00
										 |  |  |       expect(Input.allowDirtyBuild).toStrictEqual(true); | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('returns false when string false is passed', () => { | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue('false'); | 
					
						
							| 
									
										
										
										
											2020-08-10 14:30:06 +00:00
										 |  |  |       expect(Input.allowDirtyBuild).toStrictEqual(false); | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('customParameters', () => { | 
					
						
							|  |  |  |     it('returns the default value', () => { | 
					
						
							|  |  |  |       expect(Input.customParameters).toStrictEqual(''); | 
					
						
							| 
									
										
										
										
											2020-04-26 18:22:09 +00:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 15:44:56 +00:00
										 |  |  |     it('takes input from the users workflow', () => { | 
					
						
							|  |  |  |       const mockValue = '-imAFlag'; | 
					
						
							|  |  |  |       const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue); | 
					
						
							|  |  |  |       expect(Input.customParameters).toStrictEqual(mockValue); | 
					
						
							|  |  |  |       expect(spy).toHaveBeenCalledTimes(1); | 
					
						
							| 
									
										
										
										
											2020-01-27 22:03:29 +00:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2019-12-22 17:07:55 +00:00
										 |  |  |   }); | 
					
						
							|  |  |  | }); |