Skip to content

Commit 2264489

Browse files
committed
Fix crlf
1 parent 60f0d78 commit 2264489

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

src/cli.test.ts

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
import { PassThrough } from 'stream';
2-
import cli from './cli';
3-
4-
describe('cli()', () => {
5-
it('should return stdout with exitcode=0', async () => {
6-
const stdout = new PassThrough();
7-
const stderr = new PassThrough();
8-
const outData = jest.fn();
9-
stdout.on('data', outData);
10-
const errData = jest.fn();
11-
stderr.on('data', errData);
12-
expect(
13-
await cli({
14-
filename: 'test/assets/test.txt',
15-
stdout,
16-
stderr
17-
})
18-
).toEqual(0);
19-
expect(outData.mock.calls.length).toEqual(1);
20-
expect(outData.mock.calls[0][0].toString('utf8')).toEqual(
21-
'test/assets/test.txt: 15 chars\n'
22-
);
23-
expect(errData.mock.calls.length).toEqual(0);
24-
});
25-
it('should return stderr with exitcode=1', async () => {
26-
const stdout = new PassThrough();
27-
const stderr = new PassThrough();
28-
const outData = jest.fn();
29-
stdout.on('data', outData);
30-
const errData = jest.fn();
31-
stderr.on('data', errData);
32-
expect(
33-
await cli({
34-
filename: 'test/assets/fail.txt',
35-
stdout,
36-
stderr
37-
})
38-
).toEqual(1);
39-
expect(outData.mock.calls.length).toEqual(0);
40-
expect(errData.mock.calls.length).toEqual(2);
41-
expect(errData.mock.calls[0][0].toString('utf8')).toEqual(
42-
"Error: ENOENT: no such file or directory, open 'test/assets/fail.txt'"
43-
);
44-
expect(errData.mock.calls[1][0].toString('utf8')).toEqual('\n');
45-
});
46-
});
1+
import { PassThrough } from 'stream';
2+
import cli from './cli';
3+
4+
describe('cli()', () => {
5+
it('should return stdout with exitcode=0', async () => {
6+
const stdout = new PassThrough();
7+
const stderr = new PassThrough();
8+
const outData = jest.fn();
9+
stdout.on('data', outData);
10+
const errData = jest.fn();
11+
stderr.on('data', errData);
12+
expect(
13+
await cli({
14+
filename: 'test/assets/test.txt',
15+
stdout,
16+
stderr
17+
})
18+
).toEqual(0);
19+
expect(outData.mock.calls.length).toEqual(1);
20+
expect(outData.mock.calls[0][0].toString('utf8')).toEqual(
21+
'test/assets/test.txt: 15 chars\n'
22+
);
23+
expect(errData.mock.calls.length).toEqual(0);
24+
});
25+
it('should return stderr with exitcode=1', async () => {
26+
const stdout = new PassThrough();
27+
const stderr = new PassThrough();
28+
const outData = jest.fn();
29+
stdout.on('data', outData);
30+
const errData = jest.fn();
31+
stderr.on('data', errData);
32+
expect(
33+
await cli({
34+
filename: 'test/assets/fail.txt',
35+
stdout,
36+
stderr
37+
})
38+
).toEqual(1);
39+
expect(outData.mock.calls.length).toEqual(0);
40+
expect(errData.mock.calls.length).toEqual(2);
41+
expect(errData.mock.calls[0][0].toString('utf8')).toEqual(
42+
"Error: ENOENT: no such file or directory, open 'test/assets/fail.txt'"
43+
);
44+
expect(errData.mock.calls[1][0].toString('utf8')).toEqual('\n');
45+
});
46+
});

0 commit comments

Comments
 (0)