UNPKG

mojio-js-sdk

Version:

Mojio javascript REST client.

67 lines (57 loc) 1.59 kB
// Generated by CoffeeScript 1.10.0 (function() { var _; _ = require('underscore'); describe('Test Defaults and Options', function() { it('Module can extend from object', function() { var Guitar, guitar; Guitar = (function() { var defaults; defaults = { has: "default", isnt: "default" }; function Guitar(options1) { this.options = options1 != null ? options1 : {}; this.configure(this.options); } Guitar.prototype.configure = function(options) { if (options == null) { options = {}; } _.extend(this, options); _.defaults(this, defaults); return this; }; return Guitar; })(); guitar = new Guitar({ isnt: "option" }); guitar.has.should.be.equal("default"); guitar.isnt.should.be.equal("option"); guitar = new Guitar(); guitar.has.should.be.equal("default"); guitar.isnt.should.be.equal("default"); guitar = new Guitar({ another: "option" }); guitar.has.should.be.equal("default"); guitar.isnt.should.be.equal("default"); return guitar.another.should.be.equal("option"); }); return it('can extend', function() { var body; body = {}; _.extend(body, { one: "thing", two: "to go" }); _.extend(body, { three: "things" }); return console.log(JSON.stringify(body)); }); }); }).call(this); //# sourceMappingURL=TestClass.js.map