Skip to content

Commit cac069e

Browse files
committed
Changing tuxlab to lab object
1 parent 3b7e2cf commit cac069e

File tree

8 files changed

+43
-49
lines changed

8 files changed

+43
-49
lines changed

server/imports/api/lab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ lab.prototype.newTask = function(ttl, mdown,sFn, vFn, opt){
3838
}
3939
return ts;
4040
}
41-
module.exports = new lab();
41+
module.exports = lab;

server/imports/lab/checkLab.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
"use strict";
2+
var tuxOrig = require('./lab.js');
3+
4+
25
/// <reference path="./checkLab.d.ts" />
36
module.exports = function(str){
47
if(!str) { return false; } //check for file import
58
var tux = eval(str);
69
//var s = tuxlab;
7-
var tuxOrig = require('./tuxlab.js');
8-
return ((typeof tux != "undefined") &&
10+
return ((typeof tux != "undefined") &&
911
(typeof tux.setup === 'function') && //check for instructor field types
1012
(typeof tux.tasks === 'function') &&
1113
(tux.init.toString() === tuxOrig.init.toString()) && //check for unchanged
12-
(tux.newTask.toString() === tuxOrig.newTask.toString()));
14+
(tux.newTask.toString() === tuxOrig.newTask.toString()));
1315
}

server/imports/lab/tuxlab.js renamed to server/imports/lab/lab.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
var tuxlab = function(){}
1+
var lab = function(){}
22

3-
tuxlab.prototype.init = function(){
3+
lab.prototype.init = function(){
44
var slf = this;
55
var ts = { prnt: slf,
66
next: null,
@@ -14,11 +14,11 @@ tuxlab.prototype.init = function(){
1414
return ts;
1515
}
1616

17-
tuxlab.prototype.currentTask = null;
18-
tuxlab.prototype.taskList = [];
19-
tuxlab.prototype.setup;
20-
tuxlab.prototype.tasks;
21-
tuxlab.prototype.newTask = function(ttl, mdown,sFn, vFn, opt){
17+
lab.prototype.currentTask = null;
18+
lab.prototype.taskList = [];
19+
lab.prototype.setup;
20+
lab.prototype.tasks;
21+
lab.prototype.newTask = function(ttl, mdown,sFn, vFn, opt){
2222
var slf = this;
2323
var ts = { prnt: slf,
2424
setupFn: sFn,
@@ -37,4 +37,4 @@ tuxlab.prototype.newTask = function(ttl, mdown,sFn, vFn, opt){
3737
}
3838
return ts;
3939
}
40-
module.exports = new tuxlab();
40+
module.exports = lab;

server/imports/lab/methods.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
declare var Collections : any;
2-
Meteor.methods([
2+
declare var TuxLog : any;
33

4-
/**prepareLab: prepares a labExec object for the current user
5-
* takes the id of the lab and a callback as parameter
6-
* callback: (err,parseTasks,labExec)
4+
Meteor.methods({
5+
6+
/** prepareLab: prepares a labExec object for the current user
7+
* takes the id of the lab and a callback as parameter
8+
* callback: (err,parseTasks,labExec)
79
*/
8-
'prepareLab': function(labId : number, callback : any){
10+
'prepareLab' : function(labId : number, callback : any){
911
var session = require('../api/lab.session.js');
1012
var userid = Meteor.userId();
1113

@@ -55,4 +57,4 @@ Meteor.methods([
5557
* remove all vms and deleterecords after lab is completed for good. -highly optional
5658
*/
5759
}
58-
]);
60+
});

tests/tuxlab.api.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
/** Test Suite for TuxLab-App
22
using Meteor Gagarian (https://github.com/anticoders/gagarin)
33
**/
4-
var tuxlab = require('../server/imports/api/tuxlab.js');
4+
var lab = require('../server/imports/api/lab.js');
5+
var api = new lab();
56

67
describe('tuxlab.api.task tests',function(){
7-
var task1 = tuxlab.newTask("title","md",function(){},function(){});
8+
var task1 = api.newTask("title","md",function(){},function(){});
89
it('should have fields initialized',function(){
910
expect(task1).to.have.property('next')
1011
.and.equal(null);
1112
});
1213
it('should have a proper parent',function(){
1314
expect(task1).to.have.property('prnt')
14-
.and.equal(tuxlab);
15+
.and.equal(api);
1516
});
16-
var task2 = tuxlab.newTask("title2","md2",function(){},function(){});
17+
var task2 = api.newTask("title2","md2",function(){},function(){});
1718
it('should have a proper nextTask function',function(){
1819
var tsk2 = task1.nextTask(task2);
1920
expect(task1).to.have.property('next')
2021
.and.equal(task2);
2122
expect(tsk2).equal(task2);
22-
/*expect(tuxlab).to.have.property('taskList')
23+
/*expect(api).to.have.property('taskList')
2324
.and.equal([task2]);*/
2425
});
2526
it('should have a proper isLast function',function(){
@@ -31,10 +32,10 @@ describe('tuxlab.api.task tests',function(){
3132
});
3233

3334
describe('more tuxlab.api.task tests',function(){
34-
var task1 = tuxlab.newTask("title1","md1",function(){}, function(){});
35-
var task2 = tuxlab.newTask("title2","md2",function(){}, function(){});
36-
var task3 = tuxlab.newTask("title3","md3",function(){}, function(){});
37-
var task4 = tuxlab.newTask("title4","md4",function(){}, function(){});
35+
var task1 = api.newTask("title1","md1",function(){}, function(){});
36+
var task2 = api.newTask("title2","md2",function(){}, function(){});
37+
var task3 = api.newTask("title3","md3",function(){}, function(){});
38+
var task4 = api.newTask("title4","md4",function(){}, function(){});
3839
it('should be chained properly',function(){
3940
var tsk4 = task1.nextTask(task2).nextTask(task3).nextTask(task4);
4041
expect(tsk4).to.equal(task4);
@@ -65,29 +66,29 @@ describe('more tuxlab.api.task tests',function(){
6566
task4.next = null;
6667
expect(tuxlab).to.have.property('taskList')
6768
.and.equal([task2,task3,task4]);*/
68-
69+
6970
});
7071
});
7172

7273
describe('tuxlab.api.init tests',function(){
73-
var init = tuxlab.init();
74+
var init = api.init();
7475
it('should have a proper parent',function(){
7576
expect(init).to.have.property('prnt')
76-
.and.equal(tuxlab);
77+
.and.equal(api);
7778
});
7879
it('should have proper fields initialized',function(){
7980
expect(init).to.have.property('next')
8081
.and.equal(null);
8182
expect(init).to.have.property('nextTask');
8283
});
8384
it('should initialize tuxlab fields',function(){
84-
/* expect(tuxlab).to.have.property('currentTask')
85+
/* expect(api).to.have.property('currentTask')
8586
.and.equal(init);
86-
expect(tuxlab).to.have.property('taskList')
87+
expect(api).to.have.property('taskList')
8788
.and.equal([init]);*/
8889
});
89-
var init1 = tuxlab.init();
90-
var task1 = tuxlab.newTask("title","md",function(){},function(){});
90+
var init1 = api.init();
91+
var task1 = api.newTask("title","md",function(){},function(){});
9192
var tsk1 = init1.nextTask(task1);
9293
it('should have a working nextTask function', function(){
9394
expect(init1).to.have.property('next')

tests/tuxlab.db.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
Tests Meteor DB Authentication Roles and Inserts Example data for Later Use
2+
Tests Meteor DB Schema
33
**/
44

55
/**
@@ -106,16 +106,3 @@ describe('Database Schema', function(){
106106
}, [course_id, lab_id]);
107107
});
108108
});
109-
110-
/**
111-
Test Client-Side Insertion
112-
**/
113-
describe('Client-Side Insertion', function(){
114-
115-
});
116-
117-
118-
119-
/**
120-
Test Schema Enforcement
121-
**/

tests/tuxlab.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
TuxLab Test Suite
33
**/
44

5-
// Test Authentication Roles and Insert Example Data
5+
// Insert Example Data
66
require('./tuxlab.db.js');
77

88
// Test LabFile API
99
require("./tuxlab.api.js");
10+
11+
// Test User Login

tests/tuxlab.user.js

Whitespace-only changes.

0 commit comments

Comments
 (0)