Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 6f88f76

Browse files
author
Tilde Ann Thurium
committed
add unit test for unsetting commit template
1 parent a87b3a4 commit 6f88f76

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/models/repository.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2105,6 +2105,30 @@ describe('Repository', function() {
21052105
);
21062106
await assert.async.strictEqual(repository.getCommitMessage(), fs.readFileSync(templatePath, 'utf8'));
21072107
});
2108+
it('updates commit message to empty string if commit.template is unset', async function() {
2109+
const {repository, observer, subscriptions} = await wireUpObserver();
2110+
sub = subscriptions;
2111+
await observer.start();
2112+
2113+
assert.strictEqual(repository.getCommitMessage(), '');
2114+
2115+
const templatePath = path.join(repository.getWorkingDirectoryPath(), 'a.txt');
2116+
await repository.git.setConfig('commit.template', templatePath);
2117+
await expectEvents(
2118+
repository,
2119+
path.join('.git', 'config'),
2120+
);
2121+
2122+
await assert.async.strictEqual(repository.getCommitMessage(), fs.readFileSync(templatePath, 'utf8'));
2123+
2124+
await repository.git.unsetConfig('commit.template');
2125+
2126+
await expectEvents(
2127+
repository,
2128+
path.join('.git', 'config'),
2129+
);
2130+
await assert.async.strictEqual(repository.getCommitMessage(), '');
2131+
});
21082132
});
21092133

21102134
describe('merge events', function() {

0 commit comments

Comments
 (0)