|
| 1 | +import test from 'ava'; |
| 2 | +import parse from '../library/parse'; |
| 3 | +import bodyLeadingBlank from './body-leading-blank'; |
| 4 | + |
| 5 | +const messages = { |
| 6 | + simple: 'chore: subject', |
| 7 | + without: 'chore: subject\nbody', |
| 8 | + with: 'chore: subject\n\nbody' |
| 9 | +}; |
| 10 | + |
| 11 | +const parsed = { |
| 12 | + simple: parse(messages.simple), |
| 13 | + without: parse(messages.without), |
| 14 | + with: parse(messages.with) |
| 15 | +}; |
| 16 | + |
| 17 | +test('with simple message should succeed for empty keyword', t => { |
| 18 | + const [actual] = bodyLeadingBlank(parsed.simple); |
| 19 | + const expected = true; |
| 20 | + t.is(actual, expected); |
| 21 | +}); |
| 22 | + |
| 23 | +test.failing('with simple message should succeed for "never"', t => { |
| 24 | + const [actual] = bodyLeadingBlank(parsed.simple, 'never'); |
| 25 | + const expected = true; |
| 26 | + t.is(actual, expected); |
| 27 | +}); |
| 28 | + |
| 29 | +test('with simple message should succeed for "always"', t => { |
| 30 | + const [actual] = bodyLeadingBlank(parsed.simple, 'always'); |
| 31 | + const expected = true; |
| 32 | + t.is(actual, expected); |
| 33 | +}); |
| 34 | + |
| 35 | +test('without blank line before body should fail for empty keyword', t => { |
| 36 | + const [actual] = bodyLeadingBlank(parsed.without); |
| 37 | + const expected = false; |
| 38 | + t.is(actual, expected); |
| 39 | +}); |
| 40 | + |
| 41 | +test('without blank line before body should succeed for "never"', t => { |
| 42 | + const [actual] = bodyLeadingBlank(parsed.without, 'never'); |
| 43 | + const expected = true; |
| 44 | + t.is(actual, expected); |
| 45 | +}); |
| 46 | + |
| 47 | +test('without blank line before body should fail for "always"', t => { |
| 48 | + const [actual] = bodyLeadingBlank(parsed.without, 'always'); |
| 49 | + const expected = false; |
| 50 | + t.is(actual, expected); |
| 51 | +}); |
| 52 | + |
| 53 | +test('with blank line before body should succeed for empty keyword', t => { |
| 54 | + const [actual] = bodyLeadingBlank(parsed.with); |
| 55 | + const expected = true; |
| 56 | + t.is(actual, expected); |
| 57 | +}); |
| 58 | + |
| 59 | +test('with blank line before body should fail for "never"', t => { |
| 60 | + const [actual] = bodyLeadingBlank(parsed.with, 'never'); |
| 61 | + const expected = false; |
| 62 | + t.is(actual, expected); |
| 63 | +}); |
| 64 | + |
| 65 | +test('with blank line before body should succeed for "always"', t => { |
| 66 | + const [actual] = bodyLeadingBlank(parsed.with, 'always'); |
| 67 | + const expected = true; |
| 68 | + t.is(actual, expected); |
| 69 | +}); |
0 commit comments