Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions lib/parsers.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { test } from 'node:test';
import assert from 'node:assert';

import { parseVersionFromString } from './parsers.js';

test('Parse version from ProjectVersion.txt', () => {
const projectVersionContents = `m_EditorVersion: 2019.2.9f1
m_EditorVersionWithRevision: 2019.2.9f1 (ebce4d76e6e8)`;

expect(parseVersionFromString(projectVersionContents)).toBe('2019.2.9f1');
assert.strictEqual(
parseVersionFromString(projectVersionContents),
'2019.2.9f1'
);
});

test('Fail to parse version from empty string', () => {
expect(() => parseVersionFromString('')).toThrow(Error);
assert.throws(() => parseVersionFromString(''), {
name: 'Error',
message: 'Failed to parse version from string.',
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"scripts": {
"start": "node bin/index.js",
"test": "npx cross-env NODE_OPTIONS=--experimental-vm-modules jest",
"test": "node --test lib/parsers.test.js",
"update": "node bin/index.js --force",
"postinstall": "npm run update"
},
Expand Down