1 | var assert = require ('assert'),
|
2 | path = require ('path'),
|
3 | fs = require ('fs');
|
4 |
|
5 | describe ('sample folder integrity', function(){
|
6 | var sampleFolder = path.join(process.cwd(), '/samples');
|
7 |
|
8 | describe ('scaffold folder', function(){
|
9 |
|
10 | describe ('config file', function(){
|
11 | var dashboardFile = path.join(sampleFolder, 'project', 'config', 'atlasboard.json');
|
12 | it('should be valid json', function(done){
|
13 | JSON.parse(fs.readFileSync(dashboardFile));
|
14 | done();
|
15 | });
|
16 |
|
17 | it('should have live logging disabled by default', function(done){
|
18 | assert.equal(false, JSON.parse(fs.readFileSync(dashboardFile))["live-logging"].enabled);
|
19 | done();
|
20 | });
|
21 |
|
22 | });
|
23 |
|
24 | describe ('dashboard file', function(){
|
25 | var dashboardFile = path.join(sampleFolder, 'dashboard', 'default.json');
|
26 | it('should be valid json', function(done){
|
27 | JSON.parse(fs.readFileSync(dashboardFile));
|
28 | done();
|
29 | });
|
30 | });
|
31 |
|
32 | describe ('job file', function(){
|
33 | var jobFile = path.join(sampleFolder, 'job', 'default.js');
|
34 | it('should be valid executable', function(done){
|
35 | var job = require(jobFile);
|
36 |
|
37 |
|
38 | var mockedDependencies = {
|
39 | easyRequest : {
|
40 | HTML : function (options, cb) {
|
41 | cb(null, 'hi!');
|
42 | }
|
43 | }
|
44 | };
|
45 |
|
46 | job({}, mockedDependencies, function(err, data){
|
47 | assert.equal('hi!', data.html);
|
48 | done();
|
49 | });
|
50 | });
|
51 | });
|
52 | });
|
53 |
|
54 | describe ('project folder', function(){
|
55 | var projectFolder = path.join(sampleFolder, 'project');
|
56 |
|
57 | describe ('dashboard file', function(){
|
58 | var dashboardFile = path.join(projectFolder, 'packages', 'demo', 'dashboards', 'myfirst_dashboard.json');
|
59 | it('should be valid json', function(done){
|
60 | JSON.parse(fs.readFileSync(dashboardFile));
|
61 | done();
|
62 | });
|
63 | });
|
64 |
|
65 | describe ('global config file', function(){
|
66 | var globalConfigFile = path.join(projectFolder, 'config', 'dashboard_common.json');
|
67 | it('should be valid json', function(done){
|
68 | JSON.parse(fs.readFileSync(globalConfigFile));
|
69 | done();
|
70 | });
|
71 | });
|
72 | });
|
73 | }); |
\ | No newline at end of file |