/
program.test.js
62 lines (51 loc) · 1.49 KB
/
program.test.js
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*!
* let - Force timeouts.
*
* Veselin Todorov <hi@vesln.com>
* MIT Licesnse.
*/
/**
* Support.
*/
var jack = require('jack');
var should = require('chai').should();
var flatiron = require('flatiron');
var path = require('path');
/**
* Context.
*/
var Program = require('../lib/program');
describe('Program', function() {
describe('file', function() {
it('should return the file name', function() {
var program = new Program('lib/test.js');
program.file().should.eql('test.js');
});
});
describe('exec', function() {
it('should return the program exec', function() {
var program = new Program('lib/test.js');
program.exec().should.eql('node');
var program = new Program('lib/test.coffee');
program.exec().should.eql('coffee');
});
});
describe('path', function() {
it('should return the full path of the program', function() {
var program = new Program('/lib/foo.js');
program.path().should.eql('/lib/foo.js');
});
});
describe('exists', function() {
it('should return app existance', function() {
var program = new Program('/tmp/foo-bar-baz-bar.js');
program.exists().should.be.false;
var program = new Program(path.join(__dirname, 'app.test.js'));
program.exists().should.be.true;
var program = new Program('test/support/whiny.js');
program.exists().should.be.true;
var program = new Program('test/support/whiny');
program.exists().should.be.true;
});
});
});