1 | ;
|
2 | /**
|
3 | * This file is part of the @egodigital/egoose distribution.
|
4 | * Copyright (c) e.GO Digital GmbH, Aachen, Germany (https://www.e-go-digital.com/)
|
5 | *
|
6 | * @egodigital/egoose is free software: you can redistribute it and/or modify
|
7 | * it under the terms of the GNU Lesser General Public License as
|
8 | * published by the Free Software Foundation, version 3.
|
9 | *
|
10 | * @egodigital/egoose is distributed in the hope that it will be useful, but
|
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13 | * Lesser General Public License for more details.
|
14 | *
|
15 | * You should have received a copy of the GNU Lesser General Public License
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 | */
|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
19 | const assert = require("assert");
|
20 | const mocha_1 = require("mocha");
|
21 | const index_1 = require("../index");
|
22 | const stream = require("stream");
|
23 | mocha_1.describe('#readAll()', async function () {
|
24 | mocha_1.describe('Buffer', async function () {
|
25 | mocha_1.it('should return same data as input', async function () {
|
26 | for (let i = 0; i < 1000; i++) {
|
27 | const IN_STR = (new Array(i)).map(x => 'TMäöüMK')
|
28 | .join('');
|
29 | const IN_BUFF = Buffer.from(IN_STR, 'utf8');
|
30 | const IN_STREAM = new stream.PassThrough();
|
31 | IN_STREAM.end(IN_BUFF);
|
32 | const OUT_BUFF = await index_1.readAll(IN_STREAM);
|
33 | const OUT_STR = OUT_BUFF.toString('utf8');
|
34 | assert.ok(Buffer.isBuffer(OUT_BUFF));
|
35 | assert.equal(OUT_BUFF.length, IN_BUFF.length);
|
36 | assert.strictEqual(OUT_BUFF.length, IN_BUFF.length);
|
37 | assert.equal(OUT_STR, IN_STR);
|
38 | assert.strictEqual(OUT_STR, IN_STR);
|
39 | }
|
40 | });
|
41 | });
|
42 | });
|
43 | //# sourceMappingURL=readAll.js.map |
\ | No newline at end of file |