forked from sindresorhus/np
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprefix.js
More file actions
18 lines (15 loc) · 724 Bytes
/
prefix.js
File metadata and controls
18 lines (15 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import test from 'ava';
import proxyquire from 'proxyquire';
import {getTagVersionPrefix} from '../source/util';
test('get tag prefix', async t => {
t.is(await getTagVersionPrefix({yarn: false}), 'v');
t.is(await getTagVersionPrefix({yarn: true}), 'v');
});
test('no options passed', async t => {
await t.throwsAsync(getTagVersionPrefix(), {message: 'Expected `options` to be of type `object` but received type `undefined`'});
await t.throwsAsync(getTagVersionPrefix({}), {message: 'Expected object `options` to have keys `["yarn"]`'});
});
test.serial('defaults to "v" when command fails', async t => {
proxyquire('../source/util', {execa: Promise.reject});
t.is(await getTagVersionPrefix({yarn: true}), 'v');
});