mirror of
https://github.com/signalapp/libsignal.git
synced 2026-04-25 17:25:18 +02:00
This allows the file to be checked by tsc, which would have caught some of the missing type aliases sooner (now added to Native.ts.in). Strictly speaking the behavior is slightly different: we have returned to exporting many items individually instead of collecting them on a single object. Co-authored-by: Alex Bakon <akonradi@signal.org>
27 lines
749 B
TypeScript
27 lines
749 B
TypeScript
//
|
|
// Copyright 2024 Signal Messenger, LLC.
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
import { use } from 'chai';
|
|
import chaiAsPromised from 'chai-as-promised';
|
|
import { Buffer } from 'node:buffer';
|
|
|
|
import * as Native from '../Native.js';
|
|
import { Uint8ArrayInputStream } from './ioutil.js';
|
|
import { assertArrayEquals } from './util.js';
|
|
|
|
use(chaiAsPromised);
|
|
|
|
const CAPS_ALPHABET_INPUT = Buffer.from('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
|
|
|
describe('InputStream', () => {
|
|
it('handles reads into empty buffers', async () => {
|
|
const input = new Uint8ArrayInputStream(CAPS_ALPHABET_INPUT);
|
|
const output = await Native.TESTING_InputStreamReadIntoZeroLengthSlice(
|
|
input
|
|
);
|
|
assertArrayEquals(output, CAPS_ALPHABET_INPUT);
|
|
});
|
|
});
|