Refactor to typescript (#158)

* Refactor to typescript

* Fix platform and workflow

* Fix workflow and platform

* Update husky and image-tag

* Use 'yarn lint-staged' instead of 'npx lint-staged'
This commit is contained in:
David Finol
2022-01-11 05:52:29 -06:00
committed by GitHub
parent 87b202c6d9
commit cdfccd0aad
61 changed files with 24746 additions and 3168 deletions

View File

@@ -0,0 +1,25 @@
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', () => {
const projectVersionContents = `m_EditorVersion: 2019.2.11f1
m_EditorVersionWithRevision: 2019.2.11f1 (5f859a4cfee5)`;
expect(UnityVersionParser.parse(projectVersionContents)).toBe('2019.2.11f1');
});
});
describe('read', () => {
it('throws for invalid path', () => {
expect(() => UnityVersionParser.read('')).toThrow(Error);
});
it('reads from unity-project-with-correct-tests', () => {
expect(UnityVersionParser.read('./unity-project-with-correct-tests')).toBe('2019.2.11f1');
});
});
});