-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtest.js
More file actions
36 lines (30 loc) · 931 Bytes
/
test.js
File metadata and controls
36 lines (30 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import test from 'ava';
import {shellPath, shellPathSync} from './index.js';
test('async', async t => {
const PATH = await shellPath();
t.true(PATH.includes('/usr/bin'));
t.false(PATH.includes('\n'));
});
test('sync', t => {
const PATH = shellPathSync();
t.true(PATH.includes('/usr/bin'));
t.false(PATH.includes('\n'));
});
test('async - with options', async t => {
const PATH = await shellPath({shell: '/bin/bash'});
t.true(PATH.includes('/usr/bin'));
t.false(PATH.includes('\n'));
});
test('sync - with options', t => {
const PATH = shellPathSync({shell: '/bin/bash'});
t.true(PATH.includes('/usr/bin'));
t.false(PATH.includes('\n'));
});
test('async - with custom shell throws on non-executable', async t => {
await t.throwsAsync(shellPath({shell: 'non-executable'}));
});
test('sync - with custom shell throws on non-executable', t => {
t.throws(() => {
shellPathSync({shell: 'non-executable'});
});
});