Skip to content

Commit fac79b8

Browse files
committed
test: add tests for getExePath
1 parent 7508f42 commit fac79b8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/utils.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as Utils from '../lib/utils';
22
import { createFakeEditor } from './helpers';
33
import { expect } from 'chai';
44
import { Point } from 'atom';
5+
import { join, dirname } from 'path'
56

67
describe('Utils', () => {
78
describe('getWordAtPosition', () => {
@@ -30,4 +31,23 @@ describe('Utils', () => {
3031
expect(range.serialize()).eql([[0, 4], [0, 4]]);
3132
});
3233
});
34+
35+
describe('getExePath', () => {
36+
it('returns the exe path under bin folder by default', () => {
37+
const exePath = Utils.getExePath('serve-d');
38+
let expectedExe = join(dirname(dirname(__dirname)), 'bin', process.platform, 'serve-d');
39+
if (process.platform === 'win32') {
40+
expectedExe = expectedExe + '.exe';
41+
}
42+
expect(exePath).eq(expectedExe);
43+
})
44+
it('returns the exe path for the given root', () => {
45+
const exePath = Utils.getExePath('serve-d', __dirname);
46+
let expectedExe = join(__dirname, process.platform, 'serve-d');
47+
if (process.platform === 'win32') {
48+
expectedExe = expectedExe + '.exe';
49+
}
50+
expect(exePath).eq(expectedExe);
51+
})
52+
})
3353
});

0 commit comments

Comments
 (0)