Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added tests for addressable.URI and node.js URL.

  • Loading branch information...
commit 848c2689e888bc635ba3688213481e9c5b69a4e0 1 parent 91c3ddc
@slaskis slaskis authored
Showing with 27 additions and 0 deletions.
  1. +27 −0 test/test-open-uri.js
View
27 test/test-open-uri.js
@@ -1,8 +1,11 @@
var open = require("../lib/open-uri")
+ , addressable = require("addressable")
, assert = require("assert")
, Stream = require("stream").Stream
, port = 65000;
+
+
function writeStream(){
var stream = new Stream();
stream.written = false;
@@ -36,6 +39,30 @@ exports["GET a website"] = function(beforeExit){
beforeExit(function(){assert.ok(loaded)})
}
+exports["GET a website with an addressable.URI object"] = function(beforeExit){
+ var loaded = false;
+ var url = addressable.parse("http://google.com");
+ open(url,function(err,google){
+ loaded = true;
+ assert.ifError(err)
+ assert.type(google,"string")
+ assert.ok(google.length>0)
+ })
+ beforeExit(function(){assert.ok(loaded)})
+}
+
+exports["GET a website with a node.js built-in URL object"] = function(beforeExit){
+ var loaded = false;
+ var url = require("url").parse("http://google.com");
+ open(url,function(err,google){
+ loaded = true;
+ assert.ifError(err)
+ assert.type(google,"string")
+ assert.ok(google.length>0)
+ })
+ beforeExit(function(){assert.ok(loaded)})
+}
+
exports["GET an encrypted website"] = function(beforeExit){
var loaded = false;
open("https://github.com",function(err,github){
Please sign in to comment.
Something went wrong with that request. Please try again.