-
Notifications
You must be signed in to change notification settings - Fork 21
/
test.js
50 lines (40 loc) · 1.57 KB
/
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
'use strict'
var BroccoliCoffee = require('./')
var fixture = require('broccoli-fixture')
var chai = require('chai'), expect = chai.expect
var chaiAsPromised = require('chai-as-promised')
chai.use(chaiAsPromised)
function inputNodeFactory() {
return new fixture.Node({
'foo.coffee': 'console.log "Hello world"'
})
}
describe('broccoli-coffee', function() {
it('compiles .coffee files with persistence', function() {
var inputNode = inputNodeFactory()
return expect(fixture.build(new BroccoliCoffee(inputNode))).to.eventually.deep.equal({
'foo.js': '(function() {\n console.log(\"Hello world\");\n\n}).call(this);\n'
})
})
it('compiles .coffee files with without persistence', function() {
var inputNode = inputNodeFactory()
return expect(fixture.build(new BroccoliCoffee(inputNode, { persist: false }))).to.eventually.deep.equal({
'foo.js': '(function() {\n console.log(\"Hello world\");\n\n}).call(this);\n'
})
})
it('BroccoliCoffee constructor defaults with persist true if no options are passed', function() {
var inputNode = inputNodeFactory()
var broccoliCoffee = new BroccoliCoffee(inputNode);
return expect(broccoliCoffee.options).to.deep.equal({
persist: true
})
})
it('BroccoliCoffee constructor defaults with persist if no persist property is passed', function() {
var inputNode = inputNodeFactory()
var broccoliCoffee = new BroccoliCoffee(inputNode, { aRandomProp: false });
return expect(broccoliCoffee.options).to.deep.equal({
aRandomProp: false,
persist: true
})
})
})