mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
30 lines
803 B
TypeScript
30 lines
803 B
TypeScript
|
import { ReadTarball, UploadTarball } from '../src/index';
|
||
|
|
||
|
describe('mystreams', () => {
|
||
|
test('should delay events on ReadTarball abort', (cb) => {
|
||
|
const readTballStream = new ReadTarball({});
|
||
|
readTballStream.abort();
|
||
|
setTimeout(function () {
|
||
|
readTballStream.abort = function (): void {
|
||
|
cb();
|
||
|
};
|
||
|
readTballStream.abort = function (): never {
|
||
|
throw Error('fail');
|
||
|
};
|
||
|
}, 10);
|
||
|
});
|
||
|
|
||
|
test('should delay events on UploadTarball abort', (cb) => {
|
||
|
const uploadTballStream = new UploadTarball({});
|
||
|
uploadTballStream.abort();
|
||
|
setTimeout(function () {
|
||
|
uploadTballStream.abort = function (): void {
|
||
|
cb();
|
||
|
};
|
||
|
uploadTballStream.abort = function (): never {
|
||
|
throw Error('fail');
|
||
|
};
|
||
|
}, 10);
|
||
|
});
|
||
|
});
|