Skip to content
This repository has been archived by the owner on Jan 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #422 from bem/fix/build_chunk_suffix
Browse files Browse the repository at this point in the history
`getBuildResultChunk()` should've been passed source suffix, not destination
  • Loading branch information
arikon committed Aug 13, 2013
2 parents 7a07f64 + 78e2e28 commit 430eca9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/tech/v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ var Q = require('q'),
var _this = this;
return Q.all(files.map(function(file) {
return _this.getBuildResultChunk(
PATH.relative(PATH.dirname(output)+PATH.dirSep, file.absPath), file.absPath, suffix);
PATH.relative(PATH.dirname(output)+PATH.dirSep, file.absPath), file.absPath, file.suffix);
}));
},

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"mocha": "~1.11.0",
"chai": "~1.0.3",
"coverjs": ">= 0.0.7-alpha",
"jshint": "~2.1.4"
"jshint": "~2.1.4",
"sinon": "~1.7.3"
},
"scripts": {
"test": "make test",
Expand Down
1 change: 1 addition & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--reporter spec
--timeout 0
--growl
20 changes: 20 additions & 0 deletions test/tech.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

var Q = require('q'),
assert = require('chai').assert,
SINON = require('sinon'),
BEM = require('..'),
U = BEM.require('./util'),
PATH = BEM.require('./path'),
Expand Down Expand Up @@ -134,6 +135,25 @@ describe('tech', function() {
});
});

describe('getBuildResult', function() {
it('calls getBuildResultChunk with source suffix', function() {
var TechClass = getTechClass({
API_VER: 2
});

var tech = new TechClass();
tech.getBuildResultChunk = SINON.spy();
tech.getBuildResult([
{absPath: '/source.source_suffix', suffix: 'source_suffix'}
], 'dest_suffix', '/out', {});

SINON.assert.calledWith(tech.getBuildResultChunk,
SINON.match.any,
SINON.match.any,
"source_suffix");
});
});

});

function testBaseTech(techPath, techAlias) {
Expand Down

0 comments on commit 430eca9

Please sign in to comment.