2020-12-28 11:02:31 +00:00
|
|
|
import UnityVersionParser from './unity-version-parser';
|
|
|
|
|
|
|
|
describe('UnityVersionParser', () => {
|
|
|
|
describe('parse', () => {
|
|
|
|
it('throws for empty string', () => {
|
|
|
|
expect(() => UnityVersionParser.parse('')).toThrow(Error);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('parses from ProjectVersion.txt', () => {
|
2023-08-21 19:34:48 +00:00
|
|
|
const projectVersionContents = `m_EditorVersion: 2022.3.7f1
|
|
|
|
m_EditorVersionWithRevision: 2022.3.7f1 (b16b3b16c7a0)`;
|
|
|
|
expect(UnityVersionParser.parse(projectVersionContents)).toBe('2022.3.7f1');
|
2020-12-28 11:02:31 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('read', () => {
|
2021-07-01 11:39:05 +00:00
|
|
|
it('throws for invalid path', () => {
|
|
|
|
expect(() => UnityVersionParser.read('')).toThrow(Error);
|
2020-12-28 11:02:31 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('reads from unity-project-with-correct-tests', () => {
|
2023-08-21 19:34:48 +00:00
|
|
|
expect(UnityVersionParser.read('./unity-project-with-correct-tests')).toBe('2022.3.7f1');
|
2020-12-28 11:02:31 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|