Skip to content

Commit

Permalink
test: done: add test for squash merge detect
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bushong committed Oct 29, 2020
1 parent ed0a8a2 commit 1428141
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/done.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const fs = require('fs');

const assert = require('assertive');

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

it('cleans up a squash merged feature branch', async () => {
// 1. creates a feature branch and switches to it
await startAction({ deps: t, args: ['kittens'], opts: {} });

// 2. simulate a squash merge with a specific diff
await t.git.checkout('master');
fs.writeFileSync('README', 'foobar\n');
await t.git.commit('squash merge', ['README']);

// 3. simulate the same change in the feature branch
await t.git.checkout('kittens');
fs.writeFileSync('README', 'foobar\n');
await t.git.commit('my change', ['README']);

await doneAction({ deps: t });
assert.notInclude('kittens', (await t.git.branchLocal()).all);
});

it('prompts and aborts on unmerged branch', async () => {
await startAction({ deps: t, args: ['kittens'], opts: {} });
await t.changeSomething();
Expand Down

0 comments on commit 1428141

Please sign in to comment.