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

Function getPl

tests/testAccess.js:101–119  ·  view source on GitHub ↗
(cookies, shouldContainXC101, callback)

Source from the content-addressed store, hash-verified

99 /**********************************************************************/
100
101 var getPl = function(cookies, shouldContainXC101, callback) {
102 request({url: siteUrl, jar: cookies}, function (error, response, body) {
103 if (error) {
104 return callback(error);
105 }
106 if (response.statusCode != 200) {
107 return callback(new Error('bad status: ' + response.statusCode));
108 }
109 page = body;
110 try {
111 $ = cheerio.load(page);
112 elemList = $('#content td a:contains("XC 101")');
113 assert.lengthOf(elemList, shouldContainXC101 ? 1 : 0);
114 } catch (err) {
115 return callback(err);
116 }
117 callback(null);
118 });
119 };
120
121 describe('1. GET /pl', function() {
122 it('as student should not contain XC 101', function(callback) {

Callers 1

testAccess.jsFile · 0.85

Calls 2

callbackFunction · 0.85
$Function · 0.50

Tested by

no test coverage detected