Skip to content

Commit

Permalink
⬆️ Upgrade specs to match latest behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
steelbrain committed Jul 18, 2016
1 parent 8468dbc commit 122d22f
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions spec/helper-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ describe('linter helpers', function () {
waitsForAsync(async function () {
await atom.workspace.open(somethingFile)
const textEditor = atom.workspace.getActiveTextEditor()
expect(helpers.rangeFromLineNumber(textEditor)).toEqual([[0, 0], [0, 30]])
expect(helpers.rangeFromLineNumber(textEditor, -1)).toEqual([[0, 0], [0, 30]])
expect(helpers.rangeFromLineNumber(textEditor, 'a')).toEqual([[0, 0], [0, 30]])
expect(helpers.rangeFromLineNumber(textEditor).serialize()).toEqual([[0, 0], [0, 30]])
expect(helpers.rangeFromLineNumber(textEditor, -1).serialize()).toEqual([[0, 0], [0, 30]])
expect(helpers.rangeFromLineNumber(textEditor, 'a').serialize()).toEqual([[0, 0], [0, 30]])
})
)

it('ignores an invalid starting column', () =>
waitsForAsync(async function () {
await atom.workspace.open(somethingFile)
const textEditor = atom.workspace.getActiveTextEditor()
expect(helpers.rangeFromLineNumber(textEditor, 7, -1)).toEqual([[7, 0], [7, 43]])
expect(helpers.rangeFromLineNumber(textEditor, 7, 'a')).toEqual([[7, 0], [7, 43]])
expect(helpers.rangeFromLineNumber(textEditor, 7, -1).serialize()).toEqual([[7, 0], [7, 43]])
expect(helpers.rangeFromLineNumber(textEditor, 7, 'a').serialize()).toEqual([[7, 0], [7, 43]])
})
)

it('returns a range (array) with some valid points', () =>
waitsForAsync(async function () {
await atom.workspace.open(somethingFile)
const textEditor = atom.workspace.getActiveTextEditor()
const range = helpers.rangeFromLineNumber(textEditor, 7)
const range = helpers.rangeFromLineNumber(textEditor, 7).serialize()
expect(range).toEqual([[7, 0], [7, 43]])
})
)
Expand All @@ -51,7 +51,7 @@ describe('linter helpers', function () {
waitsForAsync(async function () {
await atom.workspace.open(somethingFile)
const textEditor = atom.workspace.getActiveTextEditor()
const range = helpers.rangeFromLineNumber(textEditor, 7, 4)
const range = helpers.rangeFromLineNumber(textEditor, 7, 4).serialize()
expect(range).toEqual([[7, 4], [7, 11]])
})
)
Expand Down Expand Up @@ -80,21 +80,21 @@ describe('linter helpers', function () {
waitsForAsync(async function () {
await atom.workspace.open(mixedIndentFile)
const textEditor = atom.workspace.getActiveTextEditor()
expect(helpers.rangeFromLineNumber(textEditor, 0)).toEqual([[0, 0], [0, 3]])
expect(helpers.rangeFromLineNumber(textEditor, 1)).toEqual([[1, 2], [1, 5]])
expect(helpers.rangeFromLineNumber(textEditor, 2)).toEqual([[2, 1], [2, 4]])
expect(helpers.rangeFromLineNumber(textEditor, 3)).toEqual([[3, 2], [3, 5]])
expect(helpers.rangeFromLineNumber(textEditor, 0).serialize()).toEqual([[0, 0], [0, 3]])
expect(helpers.rangeFromLineNumber(textEditor, 1).serialize()).toEqual([[1, 2], [1, 5]])
expect(helpers.rangeFromLineNumber(textEditor, 2).serialize()).toEqual([[2, 1], [2, 4]])
expect(helpers.rangeFromLineNumber(textEditor, 3).serialize()).toEqual([[3, 2], [3, 5]])
})
)

it('returns a smart colEnd when starting position is provided', function() {
waitsForAsync(async function() {
await atom.workspace.open(mixedIndentFile)
const textEditor = atom.workspace.getActiveTextEditor()
expect(helpers.rangeFromLineNumber(textEditor, 0, 0)).toEqual([[0, 0], [0, 3]])
expect(helpers.rangeFromLineNumber(textEditor, 1, 0)).toEqual([[1, 0], [1, 5]])
expect(helpers.rangeFromLineNumber(textEditor, 2, 0)).toEqual([[2, 0], [2, 4]])
expect(helpers.rangeFromLineNumber(textEditor, 3, 0)).toEqual([[3, 0], [3, 5]])
expect(helpers.rangeFromLineNumber(textEditor, 0, 0).serialize()).toEqual([[0, 0], [0, 3]])
expect(helpers.rangeFromLineNumber(textEditor, 1, 0).serialize()).toEqual([[1, 0], [1, 5]])
expect(helpers.rangeFromLineNumber(textEditor, 2, 0).serialize()).toEqual([[2, 0], [2, 4]])
expect(helpers.rangeFromLineNumber(textEditor, 3, 0).serialize()).toEqual([[3, 0], [3, 5]])
})
})
})
Expand Down

0 comments on commit 122d22f

Please sign in to comment.