-
Notifications
You must be signed in to change notification settings - Fork 3
/
umdAppConfigBuilder.js
56 lines (42 loc) · 1.8 KB
/
umdAppConfigBuilder.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
var builder = require('../src/umdAppConfigBuilder');
var TARGET = 'example.com/path/app.js';
var OPTS = createValidOpts();
describe('umdAppConfigBuilder', function(){
describe('build', function(){
it('no target', function(){
expect(builder.build).to.throw('Missing target');
});
it('should pass opts', function(){
var coreBuilder = sinon.spy(require('../src/appConfigBuilder'), 'build');
builder.build(TARGET, OPTS);
coreBuilder.should.have.been.calledWith(OPTS);
coreBuilder.restore();
});
describe('loader', function(){
it('should exist', function(){
builder.build(TARGET, OPTS).should.have.property('loader');
});
it('should have correct schema', function(){
builder.build(TARGET, OPTS).loader.should.have.property('schema', 'http://apps.d2l.com/uiapps/umdschema/v1.json' );
});
it('should have correct endpoint', function(){
builder.build(TARGET, OPTS).loader.should.have.property('endpoint', TARGET );
});
it('should have correct property showLoading', function() {
builder.build(TARGET, OPTS).loader.should.have.property('showLoading', true);
});
it('should have property showLoading as false with OPTS undefined', function() {
builder.build(TARGET).loader.should.have.property('showLoading', false);
});
});
});
});
function createValidOpts() {
return {
name: 'some-name',
version: '1.0.0.1',
description: 'It is a small world',
id: 'some-id',
showLoading: true
};
}