Skip to content

Commit

Permalink
[Gherkin / Javascript] Add test to ensure #290 is not present (and wi…
Browse files Browse the repository at this point in the history
…ll not be)
  • Loading branch information
vincent-psarga committed Oct 23, 2019
1 parent fea8d71 commit 4a7fa26
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gherkin/javascript/test/GherkinLineTest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as assert from 'assert'
import GherkinLine from '../src/GherkinLine'

describe('GherkinLine', function() {
function getCellsText(line: string) {
const gl = new GherkinLine(line, 1)

return gl.getTableCells().map(span => span.text)
}

it('getTableCells correctly trims cells content', function() {
assert.deepEqual(getCellsText("|spaces after |"), ['spaces after'])
assert.deepEqual(getCellsText("| \t spaces before|"), ['spaces before'])
assert.deepEqual(getCellsText("| \t spaces everywhere \t|"), ['spaces everywhere'])
})

it('getTableCells does not drop white spaces inside a cell', function() {
assert.deepEqual(getCellsText("| foo()\n bar\nbaz |"), ['foo()\n bar\nbaz'])
})
})

0 comments on commit 4a7fa26

Please sign in to comment.