This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ //opens the closure | |
//definition of private object Animal | |
var Animal= function(){ | |
this.name=""; | |
}; | |
Animal.prototype={ | |
getAnimal : function(code){ | |
if(code=="c"){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ //opens the closure | |
//utility function | |
function extractCode(obj){ | |
return obj.code; | |
}; | |
//definition of private object Animal | |
var Animal= function(){ | |
this.name=""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("The getAnimal function", function(){ | |
beforeEach(function(){ | |
window.myLib.initialize(); | |
}); | |
it("should set Animal name property to Cat"){ | |
window.myLib.selector.getAnimal("c") | |
expect(window.myLib.selector.name).toBe("Cat"); | |
}; | |
it("should set Animal name property to Dog"){ | |
window.myLib.selector.getAnimal("d") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ //opens the closure | |
//definition of private object Animal | |
var Animal= function(){ | |
this.name=""; | |
}; | |
Animal.prototype={ | |
getAnimal : function(code){ | |
if(code=="c"){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ //opens the closure | |
//definition of private object Animal | |
var Animal= function(){ | |
this.name=""; | |
}; | |
Animal.prototype={ | |
getAnimal : function(code){ | |
//AJAX call to get the description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("The getAnimalCallBackFn function", function(){ | |
it("should set Animal name property"){ | |
window.myLib.initialize(); | |
window.myLib.selector.getAnimal (); | |
window.myLib.selector.getAnimalCallBackFn("dog"); | |
expect(window.myLib.selector.name).toBe("dog"); | |
}; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ //opens the closure | |
//definition of private object Animal | |
var Animal= function(){ | |
this.name=""; | |
}; | |
Animal.prototype={ | |
getAnimal : function(code){ | |
var s = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("The selectAnimal function", function(){ | |
it("should return Cat"){ | |
expect(window.myLib.selectAnimal("c")).toBe("Cat"); | |
}; | |
it("should return Dog"){ | |
expect(window.myLib.selectAnimal("d")).toBe("Dog"); | |
}; | |
it("should return unknown"){ | |
expect(window.myLib.selectAnimal()).toBe("unknown"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
var options = { | |
hostname: 'encrypted.google.com', | |
port: 443, | |
path: '/', | |
method: 'GET', | |
rejectUnauthorized: false | |
}; | |
var req = https.request(options, function(res) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
var fs = require('fs'); | |
var options = { | |
hostname: 'encrypted.google.com', | |
port: 443, | |
path: '/', | |
method: 'GET', | |
key: fs.readFileSync('/ yourapp/certs/key.pem'), | |
cert: fs.readFileSync('/yourapp/certs/cert.pem'), | |
rejectUnauthorized: true |
OlderNewer