Exemplo n.º 1
0
 it('Can serialize NDJSON values', () => {
   const serializer = transducingSerializer(false, 'json', null, null, false, true, null);
   expect(serializer.headers['Content-Type']).to.equal('application/x-ndjson; charset=UTF-8');
   const serializedResult = into([], serializer.xform, [{id: 'a'}, {id: 'b'}]).join('');
   expect(serializedResult).to.equal(`${JSON.stringify({id: 'a'})}\r\n${JSON.stringify({id: 'b'})}`);
 });
Exemplo n.º 2
0
 it('Interposing zero items result in zero items', () => {
   const xf = separate({ open: 'myBegin', separator: 'mySep', close: 'myEnd'});
   const result = into([], xf, []);
   expect(result).to.deep.equal(['myBegin', 'myEnd']);
 });
Exemplo n.º 3
0
 it('Can Separate with a begin, separator and end', () => {
   const xf = separate({ open: 'myBegin', separator: 'mySep', close: 'myEnd'});
   const result = into([], xf, ['a', 'b', 'c']);
   expect(result).to.deep.equal(['myBegin', 'a', 'mySep', 'b', 'mySep', 'c', 'myEnd']);
 });
Exemplo n.º 4
0
 it('Interposing a single item results in just that item', () => {
   const xf = separate({ open: 'myBegin', separator: 'mySep', close: 'myEnd'});
   const result = into([], xf, ['a']);
   expect(result).to.deep.equal(['myBegin', 'a', 'myEnd']);
 });