Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 1428141

Browse files
author
David Bushong
committed
test: done: add test for squash merge detect
1 parent ed0a8a2 commit 1428141

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/done.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
22

3+
const fs = require('fs');
4+
35
const assert = require('assertive');
46

57
const addHooks = require('./test-common');
@@ -14,6 +16,24 @@ describe('done', () => {
1416
assert.notInclude('kittens', (await t.git.branchLocal()).all);
1517
});
1618

19+
it('cleans up a squash merged feature branch', async () => {
20+
// 1. creates a feature branch and switches to it
21+
await startAction({ deps: t, args: ['kittens'], opts: {} });
22+
23+
// 2. simulate a squash merge with a specific diff
24+
await t.git.checkout('master');
25+
fs.writeFileSync('README', 'foobar\n');
26+
await t.git.commit('squash merge', ['README']);
27+
28+
// 3. simulate the same change in the feature branch
29+
await t.git.checkout('kittens');
30+
fs.writeFileSync('README', 'foobar\n');
31+
await t.git.commit('my change', ['README']);
32+
33+
await doneAction({ deps: t });
34+
assert.notInclude('kittens', (await t.git.branchLocal()).all);
35+
});
36+
1737
it('prompts and aborts on unmerged branch', async () => {
1838
await startAction({ deps: t, args: ['kittens'], opts: {} });
1939
await t.changeSomething();

0 commit comments

Comments
 (0)