Skip to content

Commit ee86354

Browse files
Add tests for new lastcommitdatetime
1 parent e79d3c7 commit ee86354

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib/index.spec.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,32 @@ describe('git-revision-webpack-plugin (unit)', function () {
102102
expect(runGitCommand.args[0][1]).to.eql('custom branch command')
103103
})
104104
})
105+
106+
describe('on setting custom last commit date time command', function () {
107+
it('should run the build on .apply', function () {
108+
var buildFile = sinon.spy()
109+
GitRevisionPlugin.__set__('buildFile', buildFile)
110+
111+
new GitRevisionPlugin({
112+
lastCommitDateTimeCommand: 'custom last commit date time command'
113+
}).apply()
114+
115+
var lastCommitDateTimeCall = buildFile.args.find(function (calls) {
116+
return calls[0].asset === 'LASTCOMMITDATETIME'
117+
})
118+
119+
expect(lastCommitDateTimeCall[0].command).to.eql('custom last commit date time command')
120+
})
121+
122+
it('should run the custom git command on .lastcommitdatetime', function () {
123+
var runGitCommand = sinon.spy()
124+
GitRevisionPlugin.__set__('runGitCommand', runGitCommand)
125+
126+
new GitRevisionPlugin({
127+
lastCommitDateTimeCommand: 'custom last commit date time command'
128+
}).lastcommitdatetime()
129+
130+
expect(runGitCommand.args[0][1]).to.eql('custom last commit date time command')
131+
})
132+
})
105133
})

0 commit comments

Comments
 (0)