Skip to content

Commit

Permalink
Lint fixture file from git-diff package
Browse files Browse the repository at this point in the history
  • Loading branch information
rafeca committed Feb 25, 2019
1 parent e734434 commit 20ec642
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 26 deletions.
6 changes: 3 additions & 3 deletions packages/git-diff/spec/diff-list-view-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('git-diff:toggle-diff-list', () => {

runs(() => {
editor = atom.workspace.getActiveTextEditor()
editor.setCursorBufferPosition([4, 29])
editor.setCursorBufferPosition([3, 28])
editor.insertText('a')
atom.commands.dispatch(editor.getElement(), 'git-diff:toggle-diff-list')
})
Expand All @@ -35,7 +35,7 @@ describe('git-diff:toggle-diff-list', () => {

it('shows a list of all diff hunks', () => {
diffListView = document.querySelector('.diff-list-view ol')
expect(diffListView.textContent).toBe('while(items.length > 0) {a-5,1 +5,1')
expect(diffListView.textContent).toBe('var pivot = items.shift(a)-4,1 +4,1')
})

it('moves the cursor to the selected hunk', () => {
Expand All @@ -44,6 +44,6 @@ describe('git-diff:toggle-diff-list', () => {
document.querySelector('.diff-list-view'),
'core:confirm'
)
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([3, 4])
})
})
Empty file.
Empty file.
Binary file modified packages/git-diff/spec/fixtures/working-dir/git.git/index
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
745ed7547d15a61bc4ee7e182615590f44aca201 refs/heads/master
Empty file.
Empty file.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
P pack-fb30b46ead026befe94c88f5591a6d3dfdca4e95.pack

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pack-refs with: peeled fully-peeled sorted
745ed7547d15a61bc4ee7e182615590f44aca201 refs/heads/master

This file was deleted.

28 changes: 17 additions & 11 deletions packages/git-diff/spec/fixtures/working-dir/sample.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
var quicksort = function () {
var sort = function(items) {
if (items.length <= 1) return items;
var pivot = items.shift(), current, left = [], right = [];
while(items.length > 0) {
current = items.shift();
current < pivot ? left.push(current) : right.push(current);
module.exports.quicksort = function () {
var sort = function (items) {
if (items.length <= 1) return items
var pivot = items.shift()
var current
var left = []
var right = []

while (items.length > 0) {
current = items.shift()
current < pivot ? left.push(current) : right.push(current)
}
return sort(left).concat(pivot).concat(sort(right));
};
return sort(left)
.concat(pivot)
.concat(sort(right))
}

return sort(Array.apply(this, arguments));
};
return sort(Array.apply(this, arguments))
}
16 changes: 8 additions & 8 deletions packages/git-diff/spec/git-diff-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,33 +156,33 @@ describe('GitDiff package', () => {
describe('move-to-next-diff/move-to-previous-diff events', () => {
it('moves the cursor to first character of the next/previous diff line', () => {
editor.insertText('a')
editor.setCursorBufferPosition([5])
editor.setCursorBufferPosition([9])
editor.deleteLine()
advanceClock(editor.getBuffer().stoppedChangingDelay)

editor.setCursorBufferPosition([0])
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])

atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff')
expect(editor.getCursorBufferPosition()).toEqual([0, 0])
})

it('wraps around to the first/last diff in the file', () => {
editor.insertText('a')
editor.setCursorBufferPosition([5])
editor.setCursorBufferPosition([9])
editor.deleteLine()
advanceClock(editor.getBuffer().stoppedChangingDelay)

editor.setCursorBufferPosition([0])
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])

atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([0, 0])

atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])
})

describe('when the wrapAroundOnMoveToDiff config option is false', () => {
Expand All @@ -192,16 +192,16 @@ describe('GitDiff package', () => {

it('does not wraps around to the first/last diff in the file', () => {
editor.insertText('a')
editor.setCursorBufferPosition([5])
editor.setCursorBufferPosition([9])
editor.deleteLine()
advanceClock(editor.getBuffer().stoppedChangingDelay)

editor.setCursorBufferPosition([0])
atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])

atom.commands.dispatch(editorElement, 'git-diff:move-to-next-diff')
expect(editor.getCursorBufferPosition()).toEqual([4, 4])
expect(editor.getCursorBufferPosition()).toEqual([8, 4])

atom.commands.dispatch(editorElement, 'git-diff:move-to-previous-diff')
expect(editor.getCursorBufferPosition()).toEqual([0, 0])
Expand Down

0 comments on commit 20ec642

Please sign in to comment.