From 8cbf56229bb8c531a48200e5a8a94887854f3e6c Mon Sep 17 00:00:00 2001 From: Muhammad Ndako Date: Thu, 7 May 2020 10:23:30 +0100 Subject: [PATCH 1/5] removed conditional assertions --- test/editor-binding.test.js | 62 ++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/test/editor-binding.test.js b/test/editor-binding.test.js index cf4dfd64..7744dc27 100644 --- a/test/editor-binding.test.js +++ b/test/editor-binding.test.js @@ -24,7 +24,7 @@ changed. The stable and beta version of atom still uses electron 4 inorder to su versions, the assertions need to be made accordingly. In the future when stable and beta start compiling against electron 5, these assertions will be simplified. */ -const isDevBuild = atom.getAppName().toLowerCase().indexOf('atom dev') > -1 +// const isDevBuild = atom.getAppName().toLowerCase().indexOf('atom dev') > -1 suite('EditorBinding', function () { if (process.env.CI) this.timeout(process.env.TEST_TIMEOUT_IN_MS) @@ -107,17 +107,17 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - if (isDevBuild) { - return assert.deepEqual( - cursorDecoratedRanges, - [ - {tail: Point(10, 0), head: Point(11, 4)}, - {tail: Point(20, 5), head: Point(20, 0)}, - {tail: Point(3, 0), head: Point(4, 2)}, - {tail: Point(6, 0), head: Point(5, 0)} - ] - ) - } + // if (isDevBuild) { + // return assert.deepEqual( + // cursorDecoratedRanges, + // [ + // {tail: Point(10, 0), head: Point(11, 4)}, + // {tail: Point(20, 5), head: Point(20, 0)}, + // {tail: Point(3, 0), head: Point(4, 2)}, + // {tail: Point(6, 0), head: Point(5, 0)} + // ] + // ) + // } assert.deepEqual( cursorDecoratedRanges, @@ -163,16 +163,16 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - if (isDevBuild) { - return assert.deepEqual( - cursorDecoratedRanges, - [ - {tail: Point(10, 0), head: Point(11, 4)}, - {tail: Point(20, 0), head: Point(20, 5)}, - {tail: Point(3, 0), head: Point(4, 2)} - ] - ) - } + // if (isDevBuild) { + // return assert.deepEqual( + // cursorDecoratedRanges, + // [ + // {tail: Point(10, 0), head: Point(11, 4)}, + // {tail: Point(20, 0), head: Point(20, 5)}, + // {tail: Point(3, 0), head: Point(4, 2)} + // ] + // ) + // } assert.deepEqual( cursorDecoratedRanges, [ @@ -266,15 +266,15 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - if (isDevBuild) { - return assert.deepEqual( - cursorDecoratedRanges, - [ - {tail: Point(0, 3), head: Point(0, 3)}, - {tail: Point(0, 6), head: Point(0, 6)} - ] - ) - } + // if (isDevBuild) { + // return assert.deepEqual( + // cursorDecoratedRanges, + // [ + // {tail: Point(0, 3), head: Point(0, 3)}, + // {tail: Point(0, 6), head: Point(0, 6)} + // ] + // ) + // } assert.deepEqual( cursorDecoratedRanges, From 84244ce8f459d3fb286d89c5836b8067b26e358a Mon Sep 17 00:00:00 2001 From: Muhammad Ndako Date: Thu, 7 May 2020 10:26:12 +0100 Subject: [PATCH 2/5] commented unused var --- test/editor-binding.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/editor-binding.test.js b/test/editor-binding.test.js index 7744dc27..3d62201c 100644 --- a/test/editor-binding.test.js +++ b/test/editor-binding.test.js @@ -3,7 +3,7 @@ const fs = require('fs') const path = require('path') const SAMPLE_TEXT = fs.readFileSync(path.join(__dirname, 'fixtures', 'sample.js'), 'utf8') const {TextEditor, TextBuffer, Range} = require('atom') -const {Point} = TextBuffer +// const {Point} = TextBuffer const EditorBinding = require('../lib/editor-binding') const {buildAtomEnvironment, destroyAtomEnvironments} = require('./helpers/atom-environments') const {loadPackageStyleSheets} = require('./helpers/ui-helpers') From 560764be4575a30bec25fcd0d2496ade073fcb6f Mon Sep 17 00:00:00 2001 From: Muhammad Ndako Date: Thu, 7 May 2020 10:34:08 +0100 Subject: [PATCH 3/5] added conditional assertions --- test/editor-binding.test.js | 64 ++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/test/editor-binding.test.js b/test/editor-binding.test.js index 3d62201c..cf4dfd64 100644 --- a/test/editor-binding.test.js +++ b/test/editor-binding.test.js @@ -3,7 +3,7 @@ const fs = require('fs') const path = require('path') const SAMPLE_TEXT = fs.readFileSync(path.join(__dirname, 'fixtures', 'sample.js'), 'utf8') const {TextEditor, TextBuffer, Range} = require('atom') -// const {Point} = TextBuffer +const {Point} = TextBuffer const EditorBinding = require('../lib/editor-binding') const {buildAtomEnvironment, destroyAtomEnvironments} = require('./helpers/atom-environments') const {loadPackageStyleSheets} = require('./helpers/ui-helpers') @@ -24,7 +24,7 @@ changed. The stable and beta version of atom still uses electron 4 inorder to su versions, the assertions need to be made accordingly. In the future when stable and beta start compiling against electron 5, these assertions will be simplified. */ -// const isDevBuild = atom.getAppName().toLowerCase().indexOf('atom dev') > -1 +const isDevBuild = atom.getAppName().toLowerCase().indexOf('atom dev') > -1 suite('EditorBinding', function () { if (process.env.CI) this.timeout(process.env.TEST_TIMEOUT_IN_MS) @@ -107,17 +107,17 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - // if (isDevBuild) { - // return assert.deepEqual( - // cursorDecoratedRanges, - // [ - // {tail: Point(10, 0), head: Point(11, 4)}, - // {tail: Point(20, 5), head: Point(20, 0)}, - // {tail: Point(3, 0), head: Point(4, 2)}, - // {tail: Point(6, 0), head: Point(5, 0)} - // ] - // ) - // } + if (isDevBuild) { + return assert.deepEqual( + cursorDecoratedRanges, + [ + {tail: Point(10, 0), head: Point(11, 4)}, + {tail: Point(20, 5), head: Point(20, 0)}, + {tail: Point(3, 0), head: Point(4, 2)}, + {tail: Point(6, 0), head: Point(5, 0)} + ] + ) + } assert.deepEqual( cursorDecoratedRanges, @@ -163,16 +163,16 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - // if (isDevBuild) { - // return assert.deepEqual( - // cursorDecoratedRanges, - // [ - // {tail: Point(10, 0), head: Point(11, 4)}, - // {tail: Point(20, 0), head: Point(20, 5)}, - // {tail: Point(3, 0), head: Point(4, 2)} - // ] - // ) - // } + if (isDevBuild) { + return assert.deepEqual( + cursorDecoratedRanges, + [ + {tail: Point(10, 0), head: Point(11, 4)}, + {tail: Point(20, 0), head: Point(20, 5)}, + {tail: Point(3, 0), head: Point(4, 2)} + ] + ) + } assert.deepEqual( cursorDecoratedRanges, [ @@ -266,15 +266,15 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - // if (isDevBuild) { - // return assert.deepEqual( - // cursorDecoratedRanges, - // [ - // {tail: Point(0, 3), head: Point(0, 3)}, - // {tail: Point(0, 6), head: Point(0, 6)} - // ] - // ) - // } + if (isDevBuild) { + return assert.deepEqual( + cursorDecoratedRanges, + [ + {tail: Point(0, 3), head: Point(0, 3)}, + {tail: Point(0, 6), head: Point(0, 6)} + ] + ) + } assert.deepEqual( cursorDecoratedRanges, From 745a6c6a037440325aaf7a4721cb6d2cf252c621 Mon Sep 17 00:00:00 2001 From: Muhammad Ndako Date: Thu, 7 May 2020 10:59:41 +0100 Subject: [PATCH 4/5] added atom beta to conditional assertion --- test/editor-binding.test.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/editor-binding.test.js b/test/editor-binding.test.js index cf4dfd64..ccda89c0 100644 --- a/test/editor-binding.test.js +++ b/test/editor-binding.test.js @@ -24,7 +24,8 @@ changed. The stable and beta version of atom still uses electron 4 inorder to su versions, the assertions need to be made accordingly. In the future when stable and beta start compiling against electron 5, these assertions will be simplified. */ -const isDevBuild = atom.getAppName().toLowerCase().indexOf('atom dev') > -1 +const appName = atom.getAppName().toLowerCase(); +const isDevOrBetaBuild = appName.indexOf('atom dev') > -1 || appName.indexOf('atom beta') > -1; suite('EditorBinding', function () { if (process.env.CI) this.timeout(process.env.TEST_TIMEOUT_IN_MS) @@ -107,7 +108,7 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - if (isDevBuild) { + if (isDevOrBetaBuild) { return assert.deepEqual( cursorDecoratedRanges, [ @@ -163,7 +164,7 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - if (isDevBuild) { + if (isDevOrBetaBuild) { return assert.deepEqual( cursorDecoratedRanges, [ @@ -266,7 +267,7 @@ suite('EditorBinding', function () { const cursorDecoratedRanges = getCursorDecoratedRanges(editor) - if (isDevBuild) { + if (isDevOrBetaBuild) { return assert.deepEqual( cursorDecoratedRanges, [ From e807e860b32946fa908f4680595f08db1f2ef73f Mon Sep 17 00:00:00 2001 From: Muhammad Ndako Date: Thu, 7 May 2020 11:07:52 +0100 Subject: [PATCH 5/5] rm ; --- test/editor-binding.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/editor-binding.test.js b/test/editor-binding.test.js index ccda89c0..908c6f0c 100644 --- a/test/editor-binding.test.js +++ b/test/editor-binding.test.js @@ -24,8 +24,8 @@ changed. The stable and beta version of atom still uses electron 4 inorder to su versions, the assertions need to be made accordingly. In the future when stable and beta start compiling against electron 5, these assertions will be simplified. */ -const appName = atom.getAppName().toLowerCase(); -const isDevOrBetaBuild = appName.indexOf('atom dev') > -1 || appName.indexOf('atom beta') > -1; +const appName = atom.getAppName().toLowerCase() +const isDevOrBetaBuild = appName.indexOf('atom dev') > -1 || appName.indexOf('atom beta') > -1 suite('EditorBinding', function () { if (process.env.CI) this.timeout(process.env.TEST_TIMEOUT_IN_MS)