forked from cucumber/gherkin-javascript
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGherkinLineTest.ts
36 lines (30 loc) · 995 Bytes
/
GherkinLineTest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import * as assert from 'assert'
import GherkinLine from '../src/GherkinLine'
describe('GherkinLine', () => {
describe('#getTableCells', () => {
function getCellsText(line: string) {
const gl = new GherkinLine(line, 1)
return gl.getTableCells().map((span) => span.text)
}
it('trims white spaces before cell content', () => {
assert.deepStrictEqual(getCellsText('| \t spaces before|'), [
'spaces before',
])
})
it('trims white spaces after cell content', () => {
assert.deepStrictEqual(getCellsText('|spaces after |'), [
'spaces after',
])
})
it('trims white spaces around cell content', () => {
assert.deepStrictEqual(getCellsText('| \t spaces everywhere \t|'), [
'spaces everywhere',
])
})
it('does not delete white spaces inside a cell', () => {
assert.deepStrictEqual(getCellsText('| foo()\n bar\nbaz |'), [
'foo()\n bar\nbaz',
])
})
})
})