@cypress/core-socket
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,4 +1,6 @@ | ||
var fs = require("fs") | ||
var path = require("path") | ||
var server = require("socket.io") | ||
var client = require("socket.io-client") | ||
var version = require("socket.io-client/package.json").version | ||
var clientPath = require.resolve("socket.io-client") | ||
@@ -15,3 +17,11 @@ | ||
return path.join(clientPath, "..", "..", "socket.io.js") | ||
}, | ||
getClientVersion: function(){ | ||
return version | ||
}, | ||
getClientSource: function(){ | ||
return fs.readFileSync(this.getPathToClientSource(), "utf8") | ||
} | ||
} |
{ | ||
"name": "@cypress/core-socket", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Cypress Shared Socket Libs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -49,3 +49,6 @@ # Cypress Core Socket | ||
#### 0.2.0 - *(06/17/16)* | ||
- added socket.getClientVersion and socket.getClientSource methods | ||
#### 0.1.0 - *(04/29/16)* | ||
- initial release |
@@ -5,2 +5,3 @@ var fs = require("fs") | ||
var expect = require("chai").expect | ||
var pkg = require("../package.json") | ||
var lib = require("../index") | ||
@@ -27,2 +28,21 @@ | ||
}) | ||
context(".getClientVersion", function(){ | ||
it("returns client version", function(){ | ||
expect(lib.getClientVersion()).to.eq(pkg.dependencies["socket.io-client"]) | ||
}) | ||
}) | ||
context(".getClientSource", function(){ | ||
it("returns client source as a string", function(done) { | ||
var p = process.cwd() + "/node_modules/socket.io-client/socket.io.js" | ||
fs.readFile(p, "utf8", function(err, str){ | ||
if (err) done(err) | ||
expect(lib.getClientSource()).to.eq(str) | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) |
4706
65
54
2