MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / startAssessment

Function startAssessment

tests/testZoneGradingHomework.js:59–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

57 var res, page, elemList;
58
59 var startAssessment = function() {
60
61 describe('the locals object', function() {
62 it('should be cleared', function() {
63 for (var prop in locals) {
64 delete locals[prop];
65 }
66 });
67 it('should be initialized', function() {
68 locals.siteUrl = 'http://localhost:' + config.serverPort;
69 locals.baseUrl = locals.siteUrl + '/pl';
70 locals.courseInstanceBaseUrl = locals.baseUrl + '/course_instance/1';
71 locals.questionBaseUrl = locals.courseInstanceBaseUrl + '/instance_question';
72 locals.assessmentsUrl = locals.courseInstanceBaseUrl + '/assessments';
73 locals.isStudentPage = true;
74 locals.totalPoints = 0;
75 });
76 });
77
78 describe('the questions', function() {
79 it('should have cleared data', function() {
80 questionsArray.forEach(function(question) {
81 for (var prop in question) {
82 if (prop != 'qid' && prop != 'type' && prop != 'maxPoints') {
83 delete question[prop];
84 }
85 }
86 question.points = 0;
87 });
88 });
89 });
90
91 describe('the database', function() {
92 it('should contain HW6', function(callback) {
93 sqldb.queryOneRow(sql.select_hw6, [], function(err, result) {
94 if (ERR(err, callback)) return;
95 locals.assessment_id = result.rows[0].id;
96 callback(null);
97 });
98 });
99 });
100
101 describe('GET ' + locals.assessmentsUrl, function() {
102 it('should load successfully', function(callback) {
103 request(locals.assessmentsUrl, function (error, response, body) {
104 if (error) {
105 return callback(error);
106 }
107 if (response.statusCode != 200) {
108 return callback(new Error('bad status: ' + response.statusCode));
109 }
110 res = response;
111 page = body;
112 callback(null);
113 });
114 });
115 it('should parse', function() {
116 locals.$ = cheerio.load(page);

Callers 1

Calls 2

itFunction · 0.85
callbackFunction · 0.85

Tested by

no test coverage detected