| 
									
										
										
										
											2020-12-29 05:36:31 +00:00
										 |  |  | import UnityVersioning from './unity-versioning'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | describe('Unity Versioning', () => { | 
					
						
							|  |  |  |   describe('parse', () => { | 
					
						
							|  |  |  |     it('throws for empty string', () => { | 
					
						
							|  |  |  |       expect(() => UnityVersioning.parse('')).toThrow(Error); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('parses from ProjectVersion.txt', () => { | 
					
						
							|  |  |  |       const projectVersionContents = `m_EditorVersion: 2019.2.11f1
 | 
					
						
							|  |  |  |       m_EditorVersionWithRevision: 2019.2.11f1 (5f859a4cfee5)`;
 | 
					
						
							|  |  |  |       expect(UnityVersioning.parse(projectVersionContents)).toBe('2019.2.11f1'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('read', () => { | 
					
						
							| 
									
										
										
										
											2021-07-01 11:38:44 +00:00
										 |  |  |     it('throws for invalid path', () => { | 
					
						
							|  |  |  |       expect(() => UnityVersioning.read('')).toThrow(Error); | 
					
						
							| 
									
										
										
										
											2020-12-29 05:36:31 +00:00
										 |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('reads from test-project', () => { | 
					
						
							|  |  |  |       expect(UnityVersioning.read('./test-project')).toBe('2019.2.11f1'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   describe('determineUnityVersion', () => { | 
					
						
							|  |  |  |     it('defaults to parsed version', () => { | 
					
						
							|  |  |  |       expect(UnityVersioning.determineUnityVersion('./test-project', 'auto')).toBe('2019.2.11f1'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     it('use specified unityVersion', () => { | 
					
						
							|  |  |  |       expect(UnityVersioning.determineUnityVersion('./test-project', '1.2.3')).toBe('1.2.3'); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }); | 
					
						
							|  |  |  | }); |