Skip to content

Commit

Permalink
fix(transformers): fix bad newline unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
boneskull committed Jan 28, 2020
1 parent 79ce922 commit 0ef74ae
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions packages/transformers/test/newline.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import {of} from '@report-toolkit/common/src/observable.js';
import {transform} from '../src/newline.js';

describe('@report-toolkit/transformers:newline', function() {
// note that the actual newline characters are added by the CLI via console.log!

it('should parse a stream of JS objects into newline-delimited JSON', function() {
return expect(
of({bar: 2, baz: 3, foo: 1}, {bar: 5, baz: 6, foo: 4}).pipe(
transform({
newline: '\n',
fields: [
{label: 'Foo', value: 'foo'},
{label: 'Bar', value: 'bar'},
Expand All @@ -16,26 +17,28 @@ describe('@report-toolkit/transformers:newline', function() {
})
),
'to complete with values',
'{"bar":2,"baz":3,"foo":1}\n',
'{"bar":5,"baz":6,"foo":4}\n'
'{"bar":2,"baz":3,"foo":1}',
'{"bar":5,"baz":6,"foo":4}'
);
});

it('should parse a stream of strings into newline-delimited strings', function() {
return expect(
of('foo', 'bar').pipe(
transform({
newline: '\n',
fields: [
{label: 'Foo', value: 'foo'},
{label: 'Bar', value: 'bar'},
{label: 'Baz', value: 'baz'}
]
})
),
'to complete with values',
'foo\n',
'bar\n'
);
describe('when the "json" option is "false"', function() {
it('should parse a stream of strings into newline-delimited strings', function() {
return expect(
of('foo', 'bar').pipe(
transform({
fields: [
{label: 'Foo', value: 'foo'},
{label: 'Bar', value: 'bar'},
{label: 'Baz', value: 'baz'}
],
json: false
})
),
'to complete with values',
'foo',
'bar'
);
});
});
});

0 comments on commit 0ef74ae

Please sign in to comment.