Skip to content
Snippets Groups Projects
Commit 445d663d authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Resolve #61 by writing mapping exceptions

parent ff6244a3
No related branches found
No related tags found
No related merge requests found
...@@ -83,6 +83,7 @@ var mappings = { ...@@ -83,6 +83,7 @@ var mappings = {
// Microsoft Ajax CDN // Microsoft Ajax CDN
'ajax.aspnetcdn.com': { 'ajax.aspnetcdn.com': {
'/ajax/': { '/ajax/': {
'jQuery/jquery-{version}.': resources.jQuery,
'jquery/jquery-{version}.': resources.jQuery, 'jquery/jquery-{version}.': resources.jQuery,
'modernizr/modernizr-{version}.': resources.modernizr 'modernizr/modernizr-{version}.': resources.modernizr
} }
...@@ -90,6 +91,7 @@ var mappings = { ...@@ -90,6 +91,7 @@ var mappings = {
// Microsoft Ajax CDN [Deprecated] // Microsoft Ajax CDN [Deprecated]
'ajax.microsoft.com': { 'ajax.microsoft.com': {
'/ajax/': { '/ajax/': {
'jQuery/jquery-{version}.': resources.jQuery,
'jquery/jquery-{version}.': resources.jQuery, 'jquery/jquery-{version}.': resources.jQuery,
'modernizr/modernizr-{version}.': resources.modernizr 'modernizr/modernizr-{version}.': resources.modernizr
} }
......
...@@ -130,7 +130,7 @@ function _findLocalTarget(resourceMappings, basePath, channelPath) { ...@@ -130,7 +130,7 @@ function _findLocalTarget(resourceMappings, basePath, channelPath) {
var resourcePath, versionNumber, resourcePattern; var resourcePath, versionNumber, resourcePattern;
resourcePath = channelPath.replace(basePath, '').toLowerCase(); resourcePath = channelPath.replace(basePath, '');
versionNumber = resourcePath.match(VERSION_EXPRESSION); versionNumber = resourcePath.match(VERSION_EXPRESSION);
resourcePattern = resourcePath.replace(versionNumber, VERSION_PLACEHOLDER); resourcePattern = resourcePath.replace(versionNumber, VERSION_PLACEHOLDER);
......
...@@ -128,6 +128,11 @@ exports['test webfont debug library'] = function (assert) { ...@@ -128,6 +128,11 @@ exports['test webfont debug library'] = function (assert) {
assert.equal(target.path, localPaths.webfont[0], 'Target was determined.'); assert.equal(target.path, localPaths.webfont[0], 'Target was determined.');
}; };
exports['test case sensitivity rules'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('lib.sinaapp.com', '/js/WebFont/1.0.19/webfont_debug.js');
assert.equal(target, false, 'Case sensitivity rules were properly enforced.');
};
// Google Hosted Libraries // Google Hosted Libraries
exports['test angular on google hosted libraries'] = function (assert) { exports['test angular on google hosted libraries'] = function (assert) {
...@@ -187,6 +192,11 @@ exports['test jquery on microsoft ajax cdn'] = function (assert) { ...@@ -187,6 +192,11 @@ exports['test jquery on microsoft ajax cdn'] = function (assert) {
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.'); assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
}; };
exports['test lowercase jquery notation on microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.aspnetcdn.com', '/ajax/jquery/jquery-1.11.1.min.js');
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
};
exports['test modernizr on microsoft ajax cdn'] = function (assert) { exports['test modernizr on microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.aspnetcdn.com', '/ajax/modernizr/modernizr-2.6.2.js'); var target = requestAnalyzer.getLocalTarget('ajax.aspnetcdn.com', '/ajax/modernizr/modernizr-2.6.2.js');
assert.equal(target.path, localPaths.modernizr, 'Target was determined.'); assert.equal(target.path, localPaths.modernizr, 'Target was determined.');
...@@ -197,6 +207,11 @@ exports['test jquery on old microsoft ajax cdn'] = function (assert) { ...@@ -197,6 +207,11 @@ exports['test jquery on old microsoft ajax cdn'] = function (assert) {
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.'); assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
}; };
exports['test lowercase jquery notation on old microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.microsoft.com', '/ajax/jquery/jquery-1.11.1.min.js');
assert.equal(target.path, localPaths.jQuery[1], 'Target was determined.');
};
exports['test modernizr on old microsoft ajax cdn'] = function (assert) { exports['test modernizr on old microsoft ajax cdn'] = function (assert) {
var target = requestAnalyzer.getLocalTarget('ajax.microsoft.com', '/ajax/modernizr/modernizr-2.6.2.js'); var target = requestAnalyzer.getLocalTarget('ajax.microsoft.com', '/ajax/modernizr/modernizr-2.6.2.js');
assert.equal(target.path, localPaths.modernizr, 'Target was determined.'); assert.equal(target.path, localPaths.modernizr, 'Target was determined.');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment