File: test.js

package info (click to toggle)
node-trim-newlines 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 100 kB
  • ctags: 2
  • sloc: makefile: 2; sh: 2
file content (28 lines) | stat: -rw-r--r-- 622 bytes parent folder | download
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
import test from 'ava';
import fn from './';

test('main', t => {
	t.is(fn('\nx\n'), 'x');
	t.is(fn('\n\n\nx\n\n\n'), 'x');
	t.is(fn('\r\nx\r\n'), 'x');
	t.is(fn('\n\r\n\nx\n\r\n\n'), 'x');
	t.end();
});

test('start', t => {
	t.is(fn.start('\nx'), 'x');
	t.is(fn.start('\r\nx'), 'x');
	t.is(fn.start('\n\n\n\nx'), 'x');
	t.is(fn.start('\n\n\r\n\nx'), 'x');
	t.is(fn.start('x\n\n\r\n\n'), 'x\n\n\r\n\n');
	t.end();
});

test('end', t => {
	t.is(fn.end('x\n'), 'x');
	t.is(fn.end('x\r\n'), 'x');
	t.is(fn.end('x\n\n\n\n'), 'x');
	t.is(fn.end('x\n\n\r\n\n'), 'x');
	t.is(fn.end('\n\n\r\n\nx'), '\n\n\r\n\nx');
	t.end();
});