(name, selector, url, expectedEditUrl)
| 471 | } |
| 472 | |
| 473 | function findEditUrl(name, selector, url, expectedEditUrl) { |
| 474 | describe(`GET to ${name}`, function() { |
| 475 | it('should load successfully', function(callback) { |
| 476 | locals.preStartTime = Date.now(); |
| 477 | request(url, function (error, response, body) { |
| 478 | if (error) { |
| 479 | return callback(error); |
| 480 | } |
| 481 | locals.postStartTime = Date.now(); |
| 482 | if (response.statusCode != 200) { |
| 483 | return callback(new Error('bad status: ' + response.statusCode)); |
| 484 | } |
| 485 | page = body; |
| 486 | callback(null); |
| 487 | }); |
| 488 | }); |
| 489 | it('should parse', function() { |
| 490 | locals.$ = cheerio.load(page); |
| 491 | }); |
| 492 | it(`should contain edit link at ${selector}`, function() { |
| 493 | elemList = locals.$(selector); |
| 494 | assert.lengthOf(elemList, 1); |
| 495 | }); |
| 496 | it(`should match expected url in edit link`, function() { |
| 497 | assert.equal(siteUrl + elemList[0].attribs.href, expectedEditUrl); |
| 498 | }); |
| 499 | }); |
| 500 | } |
| 501 | |
| 502 | function verifyEdit(expectedToFindResults, expectedToFindChoice, expectedDraftContents, expectedDiskContents) { |
| 503 | it('should have a CSRF token', function() { |
no test coverage detected