File: test.js

package info (click to toggle)
node-has-flag 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 100 kB
  • ctags: 1
  • sloc: makefile: 2; sh: 2
file content (14 lines) | stat: -rw-r--r-- 585 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import test from 'ava';
import m from './';

test(t => {
	t.true(m('unicorn', ['--foo', '--unicorn', '--bar']));
	t.true(m('--unicorn', ['--foo', '--unicorn', '--bar']), 'optional prefix');
	t.true(m('unicorn=rainbow', ['--foo', '--unicorn=rainbow', '--bar']));
	t.true(m('unicorn', ['--unicorn', '--', '--foo']));
	t.true(m('-u', ['-f', '-u', '-b']));
	t.true(m('-u', ['-u', '--', '-f']));
	t.false(m('unicorn', ['--foo', '--', '--unicorn']), 'don\'t match flags after terminator');
	t.false(m('unicorn', ['--foo']));
	t.false(m('u', ['-f', '-u', '-b']), 'default prefix is --');
});