Fix tests

See #63

- Switch from testling to jsdom for browser APIs
- Switch from coverify to nyc for coverage reports
- Clean up related dead code and tooling
This commit is contained in:
Behind The Math committed 2018-01-08 16:54:36 -05:00
1 parent 6491e32437
commit 96b2add16f
7 files changed
+25 -12532

No files matched your search

+2 -1
View File
@@ -102,7 +102,8 @@ tape("test events on top level elements", function(t) {
el = window;
el.className = ""
on(el, "click", classCb)
// With jsdom, the default this is global, not window, so we need to explicitly bind to window.
on(el, "click", classCb.bind(window))
trigger(el, "click")
t.equal(el.className, "on", "attached callback has been fired properly on window")
+6 -4
View File
@@ -15,14 +15,16 @@ if (!('responseURL' in XMLHttpRequest.prototype)) {
}
tape("test xhr request", function(t) {
var url = "https://httpbin.org/get"
t.test("- request is made, gets a result, and is cache-busted", function(t) {
var requestCacheBust = request.bind({
options: {
cacheBust: true,
},
});
var r = requestCacheBust("https://api.github.com/", {}, function(result) {
t.equal(r.responseURL.indexOf("?"), 23, "XHR URL is cache-busted when configured to be")
var r = requestCacheBust(url, {}, function(result) {
t.equal(r.responseURL.indexOf("?"), url.length, "XHR URL is cache-busted when configured to be")
try {
result = JSON.parse(result)
}
@@ -39,8 +41,8 @@ tape("test xhr request", function(t) {
cacheBust: false,
},
});
var r = requestNoCacheBust("https://api.github.com/", {}, function() {
t.equal(r.responseURL, "https://api.github.com/", "XHR URL is left untouched")
var r = requestNoCacheBust(url, {}, function() {
t.equal(r.responseURL, url, "XHR URL is left untouched")
t.end()
})
})