UNPKG

1.01 kBJavaScriptView Raw
1'use strict';
2
3var waitOn = require('../');
4var childProcess = require('child_process');
5
6var mocha = require('mocha');
7var describe = mocha.describe;
8var it = mocha.it;
9var expect = require('expect');
10
11function execCLI(args, options) {
12 return childProcess.exec('../bin/wait-on', args, options);
13}
14
15
16describe('validation', function () {
17
18 describe('API', function () {
19 it('should return error when no resources are provided', function (done) {
20 var opts = {};
21 waitOn(opts, function (err) {
22 expect(err).toExist();
23 done();
24 });
25 });
26
27 it('should return error when opts is null', function (done) {
28 waitOn(null, function (err) {
29 expect(err).toExist();
30 done();
31 });
32 });
33
34 });
35
36 describe('CLI', function () {
37 it('should exit with non-zero error code when no resources provided', function (done) {
38 execCLI([])
39 .on('exit', function (code) {
40 expect(code).toNotBe(0);
41 done();
42 });
43 });
44 });
45
46});