Skip to content

Commit 4dc8620

Browse files
committed
fix(git-diff): Fixed linter issue and caught unnoticed spec issue.
1 parent 9a118f8 commit 4dc8620

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/git-diff/spec/git-diff-subfolder-spec.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ describe('GitDiff when targeting nested repository', () => {
2424
// The nested repo doesn't need to be managed by the temp module because
2525
// it's a part of our test environment.
2626
const nestedPath = path.join(projectPath, 'nested-repository');
27-
// When instantiating a GitRepository, the repository will always point
28-
// to the .git folder in it's path.
29-
const targetRepositoryPath = path.join(nestedPath, '.git');
3027
// Initialize the repository contents.
3128
fs.copySync(path.join(__dirname, 'fixtures', 'working-dir'), nestedPath);
3229
fs.moveSync(
@@ -58,15 +55,20 @@ describe('GitDiff when targeting nested repository', () => {
5855
* Non-hack regression prevention for nested repositories. If we know
5956
* that our project path contains two repositories, we can ensure that
6057
* git-diff is targeting the correct one by creating an artificial change
61-
* in the ancestor repository, which doesn't effect the target repository.
62-
* If our diff shows any kind of change to our target file, we're targeting
63-
* the incorrect repository.
58+
* in the ancestor repository, which is percieved differently within the
59+
* child. In this case, creating a new file will not generate markers in
60+
* the ancestor repo, even if there are changes; but changes will be
61+
* marked within the child repo. So all we have to do is check if
62+
* markers exist and we know we're targeting the proper repository,
63+
* If no markers exist, we're targeting an ancestor repo.
6464
*/
65-
it("uses the innermost repository", () => {
66-
//waitsForPromise(async () => await new Promise(resolve => setTimeout(resolve, 4000)));
67-
//waitsFor(() => !! atom.packages.isPackageLoaded("git-diff"));
65+
it('uses the innermost repository', () => {
66+
editor.insertText('a');
6867
waitsFor(() => screenUpdates > 0);
69-
runs(() => expect(editor.getMarkers().length).toBe(0));
68+
runs(() => {
69+
expect(editorElement.querySelectorAll('.git-line-modified').length)
70+
.toBe(1);
71+
});
7072
});
7173
});
7274
});

0 commit comments

Comments
 (0)