dugite-extra
Advanced tools
Comparing version 0.0.1-alpha.21 to 0.0.1-alpha.22
@@ -56,2 +56,29 @@ "use strict"; | ||
}); }); | ||
it('keeps the line breaks', function () { return __awaiter(_this, void 0, void 0, function () { | ||
var path, expected, _a, _b; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
path = track.mkdirSync('commit-line-breaks'); | ||
return [4 /*yield*/, test_helper_1.initRepository(path)]; | ||
case 1: | ||
_c.sent(); | ||
fs.createFileSync(Path.join(path, 'some-file.txt')); | ||
chai_1.expect(fs.existsSync(Path.join(path, 'some-file.txt'))).to.be.true; | ||
expected = "aaaa\n\nbbbb\n\nSigned-off-by: Akos Kitta <kittaakos@gmail.com>\n"; | ||
_a = chai_1.expect; | ||
return [4 /*yield*/, git_1.git(['add', '.'], path, 'add')]; | ||
case 2: | ||
_a.apply(void 0, [(_c.sent()).exitCode]).to.be.equal(0); | ||
return [4 /*yield*/, commit_1.createCommit(path, expected)]; | ||
case 3: | ||
_c.sent(); | ||
_b = chai_1.expect; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%B'], path, 'log')]; | ||
case 4: | ||
_b.apply(void 0, [(_c.sent()).stdout.trim()]).to.be.deep.equal(expected.trim()); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
describe('sign-off', function () { | ||
@@ -82,3 +109,3 @@ it('disabled', function () { return __awaiter(_this, void 0, void 0, function () { | ||
_b = chai_1.expect; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%s%b'], path, 'log')]; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%B'], path, 'log')]; | ||
case 5: | ||
@@ -114,3 +141,3 @@ _b.apply(void 0, [(_c.sent()).stdout.trim()]).to.not.contain(userName); | ||
_b = chai_1.expect; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%s%b'], path, 'log')]; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%B'], path, 'log')]; | ||
case 5: | ||
@@ -129,3 +156,3 @@ _b.apply(void 0, [(_c.sent()).stdout.trim()]).to.contain(userName); | ||
case 0: | ||
path = track.mkdirSync('commit-sign-off-disabled'); | ||
path = track.mkdirSync('commit-with-amend'); | ||
return [4 /*yield*/, test_helper_1.initRepository(path)]; | ||
@@ -143,7 +170,7 @@ case 1: | ||
_c.sent(); | ||
return [4 /*yield*/, git_1.git(['log', '--format=%s%b', '-z'], path, 'log')]; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%B', '-z'], path, 'log')]; | ||
case 4: | ||
beforeAmendCommits = (_c.sent()).stdout.trim().split('\0').filter(function (c) { return c.trim().length > 0; }); | ||
chai_1.expect(beforeAmendCommits).to.have.lengthOf(1); | ||
chai_1.expect(beforeAmendCommits[0].endsWith('some commit message')).to.be.true; | ||
chai_1.expect(beforeAmendCommits[0].trim().endsWith('some commit message')).to.be.true; | ||
fs.createFileSync(Path.join(path, 'another-file.txt')); | ||
@@ -158,7 +185,7 @@ chai_1.expect(fs.existsSync(Path.join(path, 'another-file.txt'))).to.be.true; | ||
_c.sent(); | ||
return [4 /*yield*/, git_1.git(['log', '--format=%s%b', '-z'], path, 'log')]; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%B', '-z'], path, 'log')]; | ||
case 7: | ||
afterAmendCommits = (_c.sent()).stdout.trim().split('\0').filter(function (c) { return c.trim().length > 0; }); | ||
chai_1.expect(afterAmendCommits).to.have.lengthOf(1); | ||
chai_1.expect(afterAmendCommits[0].endsWith('another message')).to.be.true; | ||
chai_1.expect(afterAmendCommits[0].trim().endsWith('another message')).to.be.true; | ||
return [2 /*return*/]; | ||
@@ -173,3 +200,3 @@ } | ||
case 0: | ||
path = track.mkdirSync('commit-sign-off-disabled'); | ||
path = track.mkdirSync('commit-without-amend'); | ||
return [4 /*yield*/, test_helper_1.initRepository(path)]; | ||
@@ -187,7 +214,7 @@ case 1: | ||
_c.sent(); | ||
return [4 /*yield*/, git_1.git(['log', '--format=%s%b', '-z'], path, 'log')]; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%B', '-z'], path, 'log')]; | ||
case 4: | ||
beforeAmendCommits = (_c.sent()).stdout.trim().split('\0').filter(function (c) { return c.trim().length > 0; }); | ||
chai_1.expect(beforeAmendCommits).to.have.lengthOf(1); | ||
chai_1.expect(beforeAmendCommits[0].endsWith('some commit message')).to.be.true; | ||
chai_1.expect(beforeAmendCommits[0].trim().endsWith('some commit message')).to.be.true; | ||
fs.createFileSync(Path.join(path, 'another-file.txt')); | ||
@@ -202,8 +229,8 @@ chai_1.expect(fs.existsSync(Path.join(path, 'another-file.txt'))).to.be.true; | ||
_c.sent(); | ||
return [4 /*yield*/, git_1.git(['log', '--format=%s%b', '-z'], path, 'log')]; | ||
return [4 /*yield*/, git_1.git(['log', '--format=%B', '-z'], path, 'log')]; | ||
case 7: | ||
afterAmendCommits = (_c.sent()).stdout.trim().split('\0').filter(function (c) { return c.trim().length > 0; }); | ||
chai_1.expect(afterAmendCommits).to.have.lengthOf(2); | ||
chai_1.expect(afterAmendCommits[0].endsWith('another message')).to.be.true; | ||
chai_1.expect(afterAmendCommits[1].endsWith('some commit message')).to.be.true; | ||
chai_1.expect(afterAmendCommits[0].trim().endsWith('another message')).to.be.true; | ||
chai_1.expect(afterAmendCommits[1].trim().endsWith('some commit message')).to.be.true; | ||
return [2 /*return*/]; | ||
@@ -210,0 +237,0 @@ } |
{ | ||
"name": "dugite-extra", | ||
"version": "0.0.1-alpha.21", | ||
"version": "0.0.1-alpha.22", | ||
"description": "High-level Git commands for dugite.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
@@ -17,2 +17,21 @@ import * as temp from 'temp'; | ||
it('keeps the line breaks', async () => { | ||
const path = track.mkdirSync('commit-line-breaks'); | ||
await initRepository(path); | ||
fs.createFileSync(Path.join(path, 'some-file.txt')); | ||
expect(fs.existsSync(Path.join(path, 'some-file.txt'))).to.be.true; | ||
const expected = `aaaa | ||
bbbb | ||
Signed-off-by: Akos Kitta <kittaakos@gmail.com> | ||
`; | ||
expect((await git(['add', '.'], path, 'add')).exitCode).to.be.equal(0); | ||
await createCommit(path, expected); | ||
expect((await git(['log', '--format=%B'], path, 'log')).stdout.trim()).to.be.deep.equal(expected.trim()) | ||
}); | ||
describe('sign-off', () => { | ||
@@ -33,3 +52,3 @@ it('disabled', async () => { | ||
expect((await git(['log', '--format=%s%b'], path, 'log')).stdout.trim()).to.not.contain(userName); | ||
expect((await git(['log', '--format=%B'], path, 'log')).stdout.trim()).to.not.contain(userName); | ||
}); | ||
@@ -51,3 +70,3 @@ | ||
expect((await git(['log', '--format=%s%b'], path, 'log')).stdout.trim()).to.contain(userName); | ||
expect((await git(['log', '--format=%B'], path, 'log')).stdout.trim()).to.contain(userName); | ||
}); | ||
@@ -58,3 +77,3 @@ }); | ||
it('w/', async () => { | ||
const path = track.mkdirSync('commit-sign-off-disabled'); | ||
const path = track.mkdirSync('commit-with-amend'); | ||
await initRepository(path); | ||
@@ -67,5 +86,5 @@ | ||
await createCommit(path, 'some commit message'); | ||
const beforeAmendCommits = (await git(['log', '--format=%s%b', '-z'], path, 'log')).stdout.trim().split('\0').filter(c => c.trim().length > 0); | ||
const beforeAmendCommits = (await git(['log', '--format=%B', '-z'], path, 'log')).stdout.trim().split('\0').filter(c => c.trim().length > 0); | ||
expect(beforeAmendCommits).to.have.lengthOf(1); | ||
expect(beforeAmendCommits[0].endsWith('some commit message')).to.be.true; | ||
expect(beforeAmendCommits[0].trim().endsWith('some commit message')).to.be.true; | ||
@@ -77,9 +96,9 @@ fs.createFileSync(Path.join(path, 'another-file.txt')); | ||
await createCommit(path, 'another message', false, true); | ||
const afterAmendCommits = (await git(['log', '--format=%s%b', '-z'], path, 'log')).stdout.trim().split('\0').filter(c => c.trim().length > 0); | ||
const afterAmendCommits = (await git(['log', '--format=%B', '-z'], path, 'log')).stdout.trim().split('\0').filter(c => c.trim().length > 0); | ||
expect(afterAmendCommits).to.have.lengthOf(1); | ||
expect(afterAmendCommits[0].endsWith('another message')).to.be.true; | ||
expect(afterAmendCommits[0].trim().endsWith('another message')).to.be.true; | ||
}); | ||
it('w/o', async () => { | ||
const path = track.mkdirSync('commit-sign-off-disabled'); | ||
const path = track.mkdirSync('commit-without-amend'); | ||
await initRepository(path); | ||
@@ -92,5 +111,5 @@ | ||
await createCommit(path, 'some commit message'); | ||
const beforeAmendCommits = (await git(['log', '--format=%s%b', '-z'], path, 'log')).stdout.trim().split('\0').filter(c => c.trim().length > 0); | ||
const beforeAmendCommits = (await git(['log', '--format=%B', '-z'], path, 'log')).stdout.trim().split('\0').filter(c => c.trim().length > 0); | ||
expect(beforeAmendCommits).to.have.lengthOf(1); | ||
expect(beforeAmendCommits[0].endsWith('some commit message')).to.be.true; | ||
expect(beforeAmendCommits[0].trim().endsWith('some commit message')).to.be.true; | ||
@@ -102,6 +121,6 @@ fs.createFileSync(Path.join(path, 'another-file.txt')); | ||
await createCommit(path, 'another message', false, false); | ||
const afterAmendCommits = (await git(['log', '--format=%s%b', '-z'], path, 'log')).stdout.trim().split('\0').filter(c => c.trim().length > 0); | ||
const afterAmendCommits = (await git(['log', '--format=%B', '-z'], path, 'log')).stdout.trim().split('\0').filter(c => c.trim().length > 0); | ||
expect(afterAmendCommits).to.have.lengthOf(2); | ||
expect(afterAmendCommits[0].endsWith('another message')).to.be.true; | ||
expect(afterAmendCommits[1].endsWith('some commit message')).to.be.true; | ||
expect(afterAmendCommits[0].trim().endsWith('another message')).to.be.true; | ||
expect(afterAmendCommits[1].trim().endsWith('some commit message')).to.be.true; | ||
}); | ||
@@ -108,0 +127,0 @@ }) |
Sorry, the diff of this file is not supported yet
623276
11019