From 42ab6f27036a7d84ed36e73a69e67412601e7738 Mon Sep 17 00:00:00 2001 From: Rolf Erik Lekang Date: Sat, 16 Apr 2016 17:10:01 +0200 Subject: [PATCH] test: Fix deprecation warnings from ava This was accomplished with ava-codemods --- test/checks_tests.js | 4 ++-- test/formatters/index_tests.js | 2 +- test/utils/git_tests.js | 12 ++++++------ test/utils/index_tests.js | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/checks_tests.js b/test/checks_tests.js index 07cceb8..c88167e 100644 --- a/test/checks_tests.js +++ b/test/checks_tests.js @@ -12,7 +12,7 @@ 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 } ) @@ -20,7 +20,7 @@ test('checkError(error) should resolve error object with isInDiff set to 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 } ) diff --git a/test/formatters/index_tests.js b/test/formatters/index_tests.js index 50ec02a..f3bac95 100644 --- a/test/formatters/index_tests.js +++ b/test/formatters/index_tests.js @@ -39,5 +39,5 @@ const output = [ ] test('preFormatter(data) should return formatted output', t => { - t.same(preFormatter(input), output) + t.deepEqual(preFormatter(input), output) }) diff --git a/test/utils/git_tests.js b/test/utils/git_tests.js index 414cce5..ba812a4 100644 --- a/test/utils/git_tests.js +++ b/test/utils/git_tests.js @@ -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 => { @@ -29,12 +29,12 @@ 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) => { @@ -42,7 +42,7 @@ test('getDiffInformation(hash) should return object with diff ranges for all fil 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]], diff --git a/test/utils/index_tests.js b/test/utils/index_tests.js index 0cea1b4..ab2b09c 100644 --- a/test/utils/index_tests.js +++ b/test/utils/index_tests.js @@ -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 => { @@ -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 => { @@ -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) })