From 093296dbacae14d63e48b7b478d7ecf4ae452715 Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Wed, 13 May 2015 02:19:39 +0200 Subject: [PATCH] Update tests. --- test/tests/unit/boot.js | 72 +++++++++++++++++----------------- test/tests/unit/core/server.js | 17 +++----- test/tests/unit/main/info.js | 55 ++++++++++++-------------- 3 files changed, 66 insertions(+), 78 deletions(-) diff --git a/test/tests/unit/boot.js b/test/tests/unit/boot.js index f6fc8d00..afb3a74f 100644 --- a/test/tests/unit/boot.js +++ b/test/tests/unit/boot.js @@ -2,7 +2,7 @@ 'use strict'; var ID = 'boot'; -var DEPS = ['$']; +var DEPS = ['$', 'core/server']; describe('module \'' + ID + '\'', function () { @@ -11,31 +11,24 @@ describe('module \'' + ID + '\'', function () { this.definition = modulejs._private.definitions[ID]; this.xConfig = util.uniqObj(); - this.xAjaxResult = { - done: sinon.stub().callsArgWith(0, this.xConfig), - fail: sinon.stub().callsArg(0), - always: sinon.stub().callsArg(0) - }; - this.xAjax = sinon.stub($, 'ajax').returns(this.xAjaxResult); this.xDefine = sinon.stub(modulejs, 'define'); this.xRequire = sinon.stub(modulejs, 'require'); + this.xServer = { + request: sinon.stub().callsArgWith(1, this.xConfig) + }; this.applyFn = function () { - this.xAjaxResult.done.reset(); - this.xAjaxResult.fail.reset(); - this.xAjaxResult.always.reset(); - this.xAjax.reset(); this.xDefine.reset(); this.xRequire.reset(); + this.xServer.request.reset(); - return this.definition.fn($); + return this.definition.fn($, this.xServer); }; }); after(function () { - this.xAjax.restore(); this.xDefine.restore(); this.xRequire.restore(); util.restoreHtml(); @@ -90,7 +83,7 @@ describe('module \'' + ID + '\'', function () { it('no data-module', function () { this.applyFn(); - assert.isFalse(this.xAjax.called); + assert.isFalse(this.xServer.request.called); assert.isFalse(this.xDefine.called); assert.isFalse(this.xRequire.called); }); @@ -99,25 +92,29 @@ describe('module \'' + ID + '\'', function () { $('