@expressen/tallahassee
Advanced tools
Comparing version 0.1.0 to 0.1.1
"use strict"; | ||
const cheerio = require("cheerio"); | ||
const getHeaders = require("./getHeaders"); | ||
const getLocation = require("./getLocation"); | ||
@@ -12,9 +13,5 @@ const Url = require("url"); | ||
function Document(resp) { | ||
const {request} = resp; | ||
const {header} = request || {}; | ||
const {cookie, Cookie} = header || {}; | ||
const location = getLocation(resp.request); | ||
let cookieHeader = getHeaders(resp).cookie || ""; | ||
let cookieHeader = cookie || Cookie || ""; | ||
const $ = cheerio.load(resp.text, {decodeEntities: false}); | ||
@@ -21,0 +18,0 @@ const loaded = []; |
"use strict"; | ||
const getHeaders = require("./getHeaders"); | ||
const supertest = require("supertest"); | ||
@@ -8,4 +9,5 @@ const NodeFetch = require("node-fetch"); | ||
const stack = []; | ||
const {cookie, Cookie} = resp.request.header || {}; | ||
const {cookie} = getHeaders(resp); | ||
fetching._pendingRequests = stack; | ||
@@ -33,13 +35,15 @@ return fetching; | ||
function getRelative(uri) { | ||
return supertest(app) | ||
.get(uri) | ||
.set("cookie", cookie || Cookie) | ||
.then((res) => { | ||
return { | ||
status: res.statusCode, | ||
json: () => res.body, | ||
text: () => res.text | ||
}; | ||
}); | ||
const req = supertest(app).get(uri); | ||
if (cookie) { | ||
req.set("cookie", cookie); | ||
} | ||
return req.then((res) => { | ||
return { | ||
status: res.statusCode, | ||
json: () => res.body, | ||
text: () => res.text | ||
}; | ||
}); | ||
} | ||
}; |
{ | ||
"name": "@expressen/tallahassee", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Expressen client testing framework", | ||
@@ -34,3 +34,4 @@ "main": "index.js", | ||
"express": "^4.16.2", | ||
"mocha": "^4.0.1" | ||
"mocha": "^4.0.1", | ||
"nock": "^9.1.4" | ||
}, | ||
@@ -37,0 +38,0 @@ "files": [ |
@@ -8,3 +8,3 @@ Tallahassee | ||
Test your client scripts in a headless browser | ||
Test your client scripts in a headless browser. | ||
@@ -14,5 +14,5 @@ Example: | ||
```javascript | ||
"use strict"; | ||
"use strict"; | ||
const app = require("../express-js-app"); | ||
const app = require("../app/express-js-app"); | ||
const Browser = require("@expressen/tallahassee"); | ||
@@ -64,2 +64,2 @@ const {Compiler} = require("@expressen/tallahassee/lib/Compiler"); | ||
}); | ||
`` | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18177
11
493
6