Skip to content

Commit

Permalink
Adds test to support externalMsgFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
jbalsas committed May 26, 2017
1 parent 28fa9ba commit 0eea1c2
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/fixtures/src/Message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Message {

}

export default Message;
7 changes: 7 additions & 0 deletions test/fixtures/src/Message.soy
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{namespace Templates.Message}

/**
*/
{template .render}
{msg desc="key"}message-key{/msg}
{/template}
23 changes: 23 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,29 @@ describe('Metal CLI', function() {
});
});

it('should replace extracted external messages with the provided pattern', function(done) {
runMetal([
'build',
'--src',
'test/fixtures/src/**/*.js',
'--dest',
'test/fixtures/build/globals',
'--externalMsgFormat',
'I18n.translate(\'$2\')',
'--soySrc',
'test/fixtures/src/**/Message.soy',
'--soyDest',
'test/fixtures/src'
]).on('close', function(code) {
assert.strictEqual(0, code);
assert.ok(fs.existsSync('test/fixtures/src/Message.soy.js'));

var contents = fs.readFileSync('test/fixtures/src/Message.soy.js', 'utf8');
assert.notStrictEqual(-1, contents.indexOf('I18n.translate(\'message-key\')'));
done();
});
});

it('should build soy files without generating component when soySkipMetalGeneration is passed', function(done) {
runMetal([
'build',
Expand Down

0 comments on commit 0eea1c2

Please sign in to comment.