nodulator
Version:
Complete NodeJS Framework for Restfull APIs
48 lines (38 loc) • 1.29 kB
JavaScript
/*
* Copyright 2014 the original author or authors
* @license MIT, see LICENSE.txt for details
*
* @author Scott Andrews
*/
(function (buster, define) {
'use strict';
var assert, refute, fail, failOnThrow;
assert = buster.assertions.assert;
refute = buster.assertions.refute;
fail = buster.assertions.fail;
failOnThrow = buster.assertions.failOnThrow;
define('rest/browser-test', function (require) {
var rest, defaultClient, xhr;
rest = require('rest/browser');
defaultClient = require('rest/client/default');
xhr = require('rest/client/xhr');
buster.testCase('rest/browser', {
'should be the default client': function () {
assert.same(defaultClient, rest);
},
'should wrap the xhr client': function () {
assert.same(xhr, rest.getDefaultClient());
}
});
});
}(
this.buster || require('buster'),
typeof define === 'function' && define.amd ? define : function (id, factory) {
var packageName = id.split(/[\/\-]/)[0], pathToRoot = id.replace(/[^\/]+/g, '..');
pathToRoot = pathToRoot.length > 2 ? pathToRoot.substr(3) : pathToRoot;
factory(function (moduleId) {
return require(moduleId.indexOf(packageName) === 0 ? pathToRoot + moduleId.substr(packageName.length) : moduleId);
});
}
// Boilerplate for AMD and Node
));