Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing array bases versionPath conversion on mapped

  • Loading branch information...
commit 2d55b3a1de9cd6f80cba6416ef7538ec11fd361a 1 parent 29a6fef
@serby authored
Showing with 6 additions and 4 deletions.
  1. +2 −2 lib/middleware/mapped.js
  2. +4 −2 test/mapped-versionator.test.js
View
4 lib/middleware/mapped.js
@@ -22,8 +22,8 @@ module.exports = function(mappedPaths) {
}
// This doesn't look right
- return urlPath.map(function() {
- return mappedPaths[urlPath.toString()] || urlPath
+ return urlPath.map(function(singleUrl) {
+ return mappedPaths[singleUrl.toString()] || singleUrl
})
},
View
6 test/mapped-versionator.test.js
@@ -36,8 +36,10 @@ describe('versionator', function() {
})
it('should convert all urls in an array', function() {
- var mapped = versionator.createMapped({ '/js/test.js': '/js/HASH/test.js'})
- mapped.versionPath(['/js/test.js']).should.eql(['/js/HASH/test.js'])
+ var mapped = versionator.createMapped(
+ { '/js/test.js': '/js/HASH/test.js'
+ , '/js/foo/test.js': '/js/foo/HASH/test.js'})
+ mapped.versionPath(['/js/test.js', '/js/foo/test.js']).should.eql(['/js/HASH/test.js', '/js/foo/HASH/test.js'])
})
it('should return an empty array when passed an empty url', function() {
Please sign in to comment.
Something went wrong with that request. Please try again.