Commit 9b760c4c authored by Phil Hughes's avatar Phil Hughes

added getter spec for preBuiltCommitMessage

parent 44484cfc
......@@ -81,4 +81,48 @@ describe('IDE commit module getters', () => {
});
});
});
describe('preBuiltCommitMessage', () => {
let rootState = {};
beforeEach(() => {
rootState.changedFiles = [];
rootState.stagedFiles = [];
});
afterEach(() => {
rootState = {};
});
it('returns commitMessage when set', () => {
state.commitMessage = 'test commit message';
expect(getters.preBuiltCommitMessage(state, null, rootState)).toBe('test commit message');
});
['changedFiles', 'stagedFiles'].forEach(key => {
it('returns commitMessage with updated file', () => {
rootState[key].push({
path: 'test-file',
});
expect(getters.preBuiltCommitMessage(state, null, rootState)).toBe('Update test-file');
});
it('returns commitMessage with updated files', () => {
rootState[key].push(
{
path: 'test-file',
},
{
path: 'index.js',
},
);
expect(getters.preBuiltCommitMessage(state, null, rootState)).toBe(
'Update test-file, index.js files',
);
});
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment