Skip to content

Commit a1192ae

Browse files
committed
Fix streaming tests
Update some test names for streaming tests. Decompress back to test streaming compressing.
1 parent 24c4db6 commit a1192ae

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/brotli.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,10 @@ describe("Brotli-wasm", () => {
9595
expect(stream.result()).to.equal(brotli.BrotliStreamResult.NeedsMoreInput);
9696
const output3 = stream.compress(undefined, 100);
9797
expect(stream.result()).to.equal(brotli.BrotliStreamResult.ResultSuccess);
98-
// It will be CwOAVGVzdCBpbjgACHB1dCBkYXRhAw== which is different.
98+
// It will be different from non-streaming result.
9999
// But it can still be decompressed back to the original string.
100-
// expect(Buffer.concat([output1, output2, output3]).toString('base64')).to.equal('CweAVGVzdCBpbnB1dCBkYXRhAw==');
100+
let output = Buffer.concat([output1, output2, output3]);
101+
expect(Buffer.from(brotli.decompress(output)).toString('base64')).to.equal(input.toString('base64'));
101102
});
102103

103104
it("can streamingly decompress data", () => {
@@ -137,7 +138,7 @@ describe("Brotli-wasm", () => {
137138
expect(stream.result()).to.lt(0);
138139
});
139140

140-
it("can compress & decompress back to the original result", () => {
141+
it("can streamingly compress & decompress back to the original result", () => {
141142
const s = "Some thrilling text I urgently need to compress";
142143
const encInput = Buffer.from(s);
143144
const encInput1 = encInput.slice(0, encInput.length / 2);
@@ -163,7 +164,7 @@ describe("Brotli-wasm", () => {
163164
expect(decOutput.toString('utf8')).to.equal(s);
164165
});
165166

166-
it("can compress & decompress back to the original result with a different quality setting", () => {
167+
it("can streamingly compress & decompress back to the original result with a different quality setting", () => {
167168
const s = "Some thrilling text I urgently need to compress";
168169
const encInput = Buffer.from(s);
169170
const encInput1 = encInput.slice(0, encInput.length / 2);

0 commit comments

Comments
 (0)