Skip to content

Commit

Permalink
Add tests for YAML indented more than two spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Brenneke committed Feb 21, 2017
1 parent 3ff9fe7 commit 0dbc466
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/fixtures/yaml-indented-more.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TAP version 13
# test 1
not ok 1 indented more than two spaces
---
a: b
...

1..1
# tests 1
# pass 0
# fail 1
21 changes: 21 additions & 0 deletions test/observable.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,22 @@ test('parses result values', function (t) {
}
})

test('parses yaml indented more in failing assertions', function (t) {

t.plan(1)

return function (done) {

tapOut.observeStream(fixtureStream('yaml-indented-more')).failingAssertions$
.forEach(function (assertion) {

t.deepEqual(assertion.diagnostic, {
a: 'b'
}, 'parsed yaml block')
})
}
})

// Helpers

function yamlTapStream () {
Expand All @@ -283,6 +299,11 @@ function basicTapStream () {
return fs.createReadStream(__dirname + '/fixtures/basic.txt')
}

function fixtureStream (name) {

return fs.createReadStream(__dirname + '/fixtures/' + name + '.txt')
}

function filterTypeInObservable$ (stream, type) {

return tapOut.observeStream(stream)
Expand Down
21 changes: 21 additions & 0 deletions test/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,22 @@ test('parses result values', function (t) {
}
})

test('parses yaml indented more in failing assertions', function (t) {

t.plan(1)

return function (done) {

tapOut.observeStream(fixtureStream('yaml-indented-more')).failingAssertions$
.forEach(function (assertion) {

t.deepEqual(assertion.diagnostic, {
a: 'b'
}, 'parsed yaml block')
})
}
})

// Helpers

function yamlTapStream () {
Expand All @@ -273,6 +289,11 @@ function basicTapStream () {
return fs.createReadStream(__dirname + '/fixtures/basic.txt')
}

function fixtureStream (name) {

return fs.createReadStream(__dirname + '/fixtures/' + name + '.txt')
}

function filterTypeInStream (stream, type) {

return H(stream.pipe(tapOut.stream()))
Expand Down

0 comments on commit 0dbc466

Please sign in to comment.