feat: add backpressure support
This commit is contained in:
@@ -56,7 +56,9 @@ const makeEncoderTest = async (tags: EbmlTagTrait[]) => {
|
||||
controller.close();
|
||||
},
|
||||
});
|
||||
|
||||
const encoder = new EbmlStreamEncoder();
|
||||
|
||||
const chunks: ArrayBuffer[] = [];
|
||||
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
@@ -70,6 +72,9 @@ const makeEncoderTest = async (tags: EbmlTagTrait[]) => {
|
||||
close() {
|
||||
resolve();
|
||||
},
|
||||
abort: (e) => {
|
||||
reject(e);
|
||||
},
|
||||
})
|
||||
)
|
||||
.catch(reject);
|
||||
@@ -106,16 +111,15 @@ describe('EBML Encoder', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
describe('#writeTag', () => {
|
||||
it('throws with an incomplete tag data', async () => {
|
||||
await expect(() => makeEncoderTest([incompleteTag])).rejects.toThrow(
|
||||
/should only accept embl tag but not/
|
||||
);
|
||||
});
|
||||
it('throws with an invalid tag id', async () => {
|
||||
await expect(() => makeEncoderTest([invalidTag])).rejects.toThrow(
|
||||
/should only accept embl tag but not/
|
||||
);
|
||||
});
|
||||
it('throws with an incomplete tag data', async () => {
|
||||
await expect(() => makeEncoderTest([incompleteTag])).rejects.toThrow(
|
||||
/should only accept embl tag but not/
|
||||
);
|
||||
});
|
||||
|
||||
it('throws with an invalid tag id', async () => {
|
||||
await expect(() => makeEncoderTest([invalidTag])).rejects.toThrow(
|
||||
/should only accept embl tag but not/
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user