mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
ref #44776 Wrote a test for Repository#getCommit
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
'use strict';
|
||||
|
||||
import 'mocha';
|
||||
import { GitStatusParser, parseGitmodules } from '../git';
|
||||
import { Git, GitStatusParser, Repository, parseGitmodules } from '../git';
|
||||
import * as assert from 'assert';
|
||||
import * as sinon from 'sinon';
|
||||
|
||||
suite('git', () => {
|
||||
suite('GitStatusParser', () => {
|
||||
@@ -175,4 +176,22 @@ suite('git', () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
suite('Repository', () => {
|
||||
test('get commit', async () => {
|
||||
const spawnOption = {};
|
||||
const gitOutput = `52c293a05038d865604c2284aa8698bd087915a1
|
||||
This is a commit message.`;
|
||||
const git = sinon.createStubInstance(Git);
|
||||
git.exec = sinon.stub()
|
||||
.withArgs('REPOSITORY_ROOT', ['show', '-s', '--format=%H\n%B', 'REF'], spawnOption)
|
||||
.returns(Promise.resolve({stdout: gitOutput}));
|
||||
const repository = new Repository(git, 'REPOSITORY_ROOT');
|
||||
|
||||
assert.deepEqual(await repository.getCommit('REF'), {
|
||||
hash: '52c293a05038d865604c2284aa8698bd087915a1',
|
||||
message: 'This is a commit message.'
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user