Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff2577c

Browse files
author
Nathan Sobo
committed
Add failing specs for switching the active repository
1 parent 1dc588a commit ff2577c

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

lib/git/git-store.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ export default class GitStore {
5353

5454
getGitService (): GitService { return this.gitService }
5555

56+
getWorkingDirectory (): Promise<string> {
57+
return this.getGitService().gitRepo.getWorkingDirectory()
58+
}
59+
5660
openFile (file: FileDiff): Promise<void> {
5761
const pathName = file.getNewPathName()
5862
if (pathName) {

spec/git/git-package-spec.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,35 @@ function commit (fileListViewModel, msg) {
2727

2828
describe('GitPackage', function () {
2929
let gitPackage
30-
let repo
3130

3231
beforeEach(async () => {
33-
jasmine.useRealClock()
34-
35-
repo = copyRepository()
36-
atom.project.setPaths([repo])
37-
3832
gitPackage = new GitPackage()
39-
40-
await atom.packages.activatePackage('git')
33+
await atom.packages.activatePackage('github')
4134
})
4235

4336
afterEach(() => {
4437
gitPackage.deactivate()
4538
})
4639

40+
ffit('updates the view model of the FileListComponent panel item when the active pane item changes to a different project directory', async () => {
41+
const repoPath1 = copyRepository('test-repo')
42+
const repoPath2 = copyRepository('dummy-atom')
43+
atom.project.setPaths([repoPath1, repoPath2])
44+
45+
await atom.workspace.open(path.join(repoPath1, 'README.md'))
46+
await gitPackage.openChangesPanel()
47+
expect(await gitPackage.fileListComponent.getViewModel().getGitStore().getWorkingDirectory()).toBe(repoPath1 + '/')
48+
49+
await atom.workspace.open(path.join(repoPath2, 'src', 'config.coffee'))
50+
expect(await gitPackage.fileListComponent.getViewModel().getGitStore().getWorkingDirectory()).toBe(repoPath2 + '/')
51+
})
52+
4753
xit('closes open diffs of files that were committed', async () => {
54+
jasmine.useRealClock()
55+
56+
repo = copyRepository()
57+
atom.project.setPaths([repo])
58+
4859
fs.writeFileSync(path.join(repo, 'README.md'), 'hey diddle diddle')
4960

5061
await gitPackage.update()

0 commit comments

Comments
 (0)