Skip to content

Commit

Permalink
test: Fix deprecation warnings from ava
Browse files Browse the repository at this point in the history
This was accomplished with ava-codemods
  • Loading branch information
relekang committed Apr 16, 2016
1 parent 2e01e53 commit 42ab6f2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions test/checks_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ test.beforeEach(() => {

test('checkError(error) should resolve error object with isInDiff set to true', t => {
sandbox.stub(utils, 'isLineInDiff').returns(true)
t.same(
t.deepEqual(
checks.checkError({ message: 'some message' }),
{ message: 'some message', isInDiff: true }
)
})

test('checkError(error) should resolve error object with isInDiff set to false', t => {
sandbox.stub(utils, 'isLineInDiff').returns(false)
t.same(
t.deepEqual(
checks.checkError({ message: 'some message' }),
{ message: 'some message', isInDiff: false }
)
Expand Down
2 changes: 1 addition & 1 deletion test/formatters/index_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ const output = [
]

test('preFormatter(data) should return formatted output', t => {
t.same(preFormatter(input), output)
t.deepEqual(preFormatter(input), output)
})
12 changes: 6 additions & 6 deletions test/utils/git_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ test.beforeEach(t => {
test.afterEach(t => t.context.sandbox.restore())

test('parseDiffRanges(diff) should return empty array for no matches', t => {
t.same(gitUtils.parseDiffRanges(''), [])
t.deepEqual(gitUtils.parseDiffRanges(''), [])
})

test('parseDiffRanges(diff) should return diff range for one match', t => {
t.same(gitUtils.parseDiffRanges('@@ -0,0 +1,2 @@'), [[1, 3]])
t.same(gitUtils.parseDiffRanges('@@ -0,0 +14,20 @@'), [[14, 34]])
t.deepEqual(gitUtils.parseDiffRanges('@@ -0,0 +1,2 @@'), [[1, 3]])
t.deepEqual(gitUtils.parseDiffRanges('@@ -0,0 +14,20 @@'), [[14, 34]])
})

test('parseDiffRanges(diff) should return diff range for multiple matches', t => {
Expand All @@ -29,20 +29,20 @@ export function parseDiffRanges(diff) {
const matches = diff.match(/\@\@ -\d+,\d+ \+(\d+),(\d+) \@\@/g)
@@ -0,0 +45,55 @@
`
t.same(gitUtils.parseDiffRanges(diff), [[8, 51], [45, 100]])
t.deepEqual(gitUtils.parseDiffRanges(diff), [[8, 51], [45, 100]])
})

test(
'parseDiffRanges(diff) should return not match range if it is in the code diff',
t => t.same(gitUtils.parseDiffRanges('+@@ -8,27 +8,43 @@'), [])
t => t.deepEqual(gitUtils.parseDiffRanges('+@@ -8,27 +8,43 @@'), [])
)

test('getDiffInformation(hash) should return object with diff ranges for all files', async (t) => {
t.plan(1)
t.context.sandbox.stub(gitUtils, 'execFile').returns(Promise.resolve(diffFixture))
const diff = await gitUtils.getDiffInformation('1f2d836')

t.same(diff, {
t.deepEqual(diff, {
'lint-filter.js': [[1, 3], [2, 5]],
'src/index.js': [[4, 17]],
'src/utils.js': [[3, 44], [45, 52], [60, 67]],
Expand Down
6 changes: 3 additions & 3 deletions test/utils/index_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('hasError(result) should return true if contains error', t => {
isInDiff: true,
},
]
t.same(utils.hasError(input), true)
t.deepEqual(utils.hasError(input), true)
})

test('hasError(result) should return false if contains warning', t => {
Expand All @@ -48,7 +48,7 @@ test('hasError(result) should return false if contains warning', t => {
isInDiff: true,
},
]
t.same(utils.hasError(input), false)
t.deepEqual(utils.hasError(input), false)
})

test('hasError(result) should return false if contains error not in diff', t => {
Expand All @@ -63,5 +63,5 @@ test('hasError(result) should return false if contains error not in diff', t =>
isInDiff: false,
},
]
t.same(utils.hasError(input), false)
t.deepEqual(utils.hasError(input), false)
})

0 comments on commit 42ab6f2

Please sign in to comment.